2

I have a problem here if you look at my codes below after I call the .close line which was the file I initially copied from. It will prompt a save MessageBox message either yes, no, or cancel. Is there anyway I can avoid this save message from appearing programmatic if no was the case could I just programmatic program it no instead?

3 Answers 3

10

Jon is right to suggest Application.DisplayAlerts and if you want to answer no to a save as you suggest

 Workbooks(Filename1).Close SaveChanges:=False
Sign up to request clarification or add additional context in comments.

Comments

5

Try setting the Application.DisplayAlerts to false, then closing. I recommend turning it back on after setting it.

Application.DisplayAlerts = False
ActiveWorkbook.Close
Application.DisplayAlerts = True

Comments

0

IIRC:

Workbooks(FileName1).Save

If you save it explicitly, it won't have to ask you.

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.