0
open_book.SaveAs Filename:="E:\MF\data\" & com_tick_ask & ".xlsx", FileFormat:=xlOpenXMLWorkbook, CreateBackup:=False

This is my code to save a file as xlsx but I want to overwrite an existing file. and close this workbook. Can anyone help...

1 Answer 1

3

Sorry friends for trouble. I got an answer.

I just have to put this line of code immediately before my SaveAs statement...

Application.DisplayAlerts = False

and have to put this line of code immediately after it...

Application.DisplayAlerts = True

e.g.

Application.DisplayAlerts = False
open_book.SaveAs Filename:="E:\MF\data\" & com_tick_ask & ".xlsx", FileFormat:=xlOpenXMLWorkbook, CreateBackup:=False
Application.DisplayAlerts = True
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.