save a excel sheet in vba

J

Jean-Noel Dotter

Hello,

If I want to save a excel sheet in vba I use:

Workbooks(_FileName).Close SaveChanges:=True

but a question like "a file named ... is always existing, do you want
to exange it? <Yes> <No> <Cancel>"

how can i do in order to save my file without such query?

Regards,

Jean-Noel
 
I

ijb

This should work:

Application.DisplayAlerts = False
Workbooks("ijb.xls").Close SaveChanges:=True
Application.DisplayAlerts = True

--
If I've mis-understood the question please tell me.

HTH

ijb

Remove nospam from my e-mail address to talk direct

Not MCSD, MVP, TLA, P&P, PCMCIA, etc just trying to help
 
T

tokash

Try:

Application.DisplayAlerts = False
Workbooks(_FileName).Close SaveChanges:=True
Application.DisplayAlerts = True

Tokash
 
B

Bill Lunney

There are two main ways of stopping the save confirmation dialog appearing.

Application.DisplayAlerts = False will suppress the dialog box from
appearing in the first place.
Workbooks("fred").Close SaveChanges:=True
A couple of points to note:

If using the first option remember to turn the alerts back on (True) when
you're done.
The SaveChanges property will only work as you expect if the file access
etc. is read/write. I mention this as people have assumed the method
doesn't work but it's been due to workbooks opened in read only mode etc.


http://www.billlunney.com/Excel/FAQ/DisplayFAQ.ascx?ExcelFAQID=75


--
Regards,


Bill Lunney
www.billlunney.com
 

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