Click here to Skip to main content
14,733,542 members
Please Sign up or sign in to vote.
4.20/5 (4 votes)
See more:
Hi, I am trying to open and save and excel file in the background without the user being involved. I have opened the correct excel page and hidden it which works fine but when I attempt to save it I either get this file is open you can't save an open file or a save box pops up saying re-name the file.

I simply want it to save as if you just clicked save no asking about overwriting etc just save the damn thing!

Cheers in advance

Dan
Posted
Updated 27-Oct-20 0:25am

Found it! For anyone who would like it:

App.DisplayAlerts = false;
workbook.save();
workbook.Close();
App.DisplaAlerts = True;
App.Quit();
   
Comments
Tarun.K.S 12-Jul-11 8:57am
   
Excellent. 5!
DanHodgson88 12-Jul-11 9:07am
   
Thank you :)
shiva Maranur 27-Jul-11 8:03am
   
Thanks lot
[no name] 10-Sep-12 3:12am
   
5!
Ravi Kumhar 16-Apr-15 3:06am
   
If dont having xcel file then what to do?
gdmplt 27-Jan-16 3:17am
   
Great help! Thanks! :)
After much frustration trying to resolve the Workbook Save on Close without prompts, I seem to have found the cause.

Thoroughly check all your VBA coding and all your formula as well as Named Range errors.
Once cleaned up, the Workbook Save on Close works without having to disable alerts or such.
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900