macro will not close a file without "Do you want to save the changesyou made..." message

  • Thread starter Thread starter Tonso
  • Start date Start date
T

Tonso

Using XL2002, I recorded a macro. The last part of the procedure is
closing a file. When i recorded the macro, I selected "No" when
prompted if I wanted to save the changes. But when i run the macro, I
am still asked if I want to save the changes anyway. The recorded code
is...

Windows("ydata.exp").Activate
ActiveWindow.Close

What do i change to eliminate having to answer "No" regarding saving
the changes?

Thanks,

Tonso
 
Try this:

Windows("ydata.exp").Activate
Application.DisplayAlerts = False
ActiveWindow.Close
Application.DisplayAlerts = True

HTH,
Paul
 
Try:

ActiveWindow.Close (SaveChange = False)

PCLIVE said:
Try this:

Windows("ydata.exp").Activate
Application.DisplayAlerts = False
ActiveWindow.Close
Application.DisplayAlerts = True

HTH,
Paul
 
Workbooks("ydata.exp").close savechanges:=false

Savechanges is a keyword parameter in the .close method.
 
Back
Top