ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Automatically close file (https://www.excelbanter.com/excel-programming/402402-automatically-close-file.html)

[email protected]

Automatically close file
 
I have a vb script that currently opens another workbook to populate a
summary sheet, then closes that sheet. Currently i am using:
JournalWkbk.Close savechanges:=False
Which works fine except that if the user already had the workbook open
and made changes, it discards them. I want it to automatically save
the sheet. If i change it to:
JournalWkbk.Close savechanges:=True
It then brings up the "save as" dialog box. I want it to just save
over it. It tried to use:
Application.DisplayAlerts = False
JournalWkbk.Close savechanges:=True
Application.DisplayAlerts = True
But it still brings the box up. How can i make this work?

Thanks,
Sean

Dan R.

Automatically close file
 
JournalWkbk.Save

--
Dan

On Dec 7, 10:16 am, wrote:
I have a vb script that currently opens another workbook to populate a
summary sheet, then closes that sheet. Currently i am using:
JournalWkbk.Close savechanges:=False
Which works fine except that if the user already had the workbook open
and made changes, it discards them. I want it to automatically save
the sheet. If i change it to:
JournalWkbk.Close savechanges:=True
It then brings up the "save as" dialog box. I want it to just save
over it. It tried to use:
Application.DisplayAlerts = False
JournalWkbk.Close savechanges:=True
Application.DisplayAlerts = True
But it still brings the box up. How can i make this work?

Thanks,
Sean




All times are GMT +1. The time now is 12:43 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com