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

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
 
P

PCLIVE

Try this:

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

HTH,
Paul
 
N

ND Pard

Try:

ActiveWindow.Close (SaveChange = False)

PCLIVE said:
Try this:

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

HTH,
Paul
 
D

Dave Peterson

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

Savechanges is a keyword parameter in the .close method.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top