How to suppress "Do you want to save" dialog when closing a workbook in a Macro?

M

M

Hello,

Say I have this code in a macro:

Application.ScreenUpdating = False
Dim wbBook1 As Workbook
Set wbBook1 = Workbooks.Open("C:\Book1.xls")
wbBook1.Close

If Book1.xls contains formulas, when this code executes, the dialog
box comes up asking "Do you want to save the changes you made..." with
the options Yes/No/Cancel. How can I make it so that dialog box
doesn't come up? If a button has to be chosen, preferably it would be
No, to save time when executing.

Any help would be greatly appreciated. Thanks!

-Mike
 
B

Bob Phillips

wbBook1.Close SaveChanges:=False

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)
 
D

Dave Peterson

wbBook1.Close SaveChanges:=false

Use :=True when/if you want to save the changes.
 
Top