ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Trap New File name before saving (https://www.excelbanter.com/excel-programming/333281-trap-new-file-name-before-saving.html)

bac

Trap New File name before saving
 
I have a "template" workbook in which a user enters a Sales Order Number and
an SQL is executed to pull relevant data from our datawarehouse into three
worksheets in the workbook.

If the user decides to save the file under a different name, I would like to
remove some code and one of the worksheets. I know I can use the
Workbook_BeforeSave event to execute this code, but I only want it to run it
if the user saves the workbook under a different name.

How can I trap the name the file will be saved to so I can compare that to
the file's current name to determine whether or not to run the desired
BeforeSave code?

TIA
BAC




Roman[_4_]

Trap New File name before saving
 
With Workbook_BeforeSave event force users to fill your own
getsaveasfilename dialog and then test the name.



All times are GMT +1. The time now is 10:35 AM.

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