Problem closing a workbook using a macro

S

Steve

The last part of my macro is a save command:

ActiveWorkbook.SaveAs
Filename:="H:\Personal\SIGINCUSTODY.csv", FileFormat _
:=xlCSV, CreateBackup:=False

The file is saved to its required location in csv format.

I then have a command that says ActiveWorkbook.Close,
however, this command will not work automatically. First
of all I get asked the question "Do you want to save the
changes you made to SIGINCUSTODY". After pressing Yes it
asks me to select the location where the file should be
saved. I select the file name as above (to where the file
has already been saved). I then asked do I want to
overwrite the file (as i have already saved it earlier in
the macro) and finally I get asked am I sure that I want
to save in csv format.

Is there anyway of just closing the file without being
asked all these questions ?

Thanks
Steve
 
N

Nikos Yannacopoulos

Steve,

ActiveWorkbook.Close False

will close the workbook without prompting to save - and without saving, but
since you've only just saved, that should be OK.

HTH,
Nikos
 

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