ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Checking whether .xls file was just opened from a template (https://www.excelbanter.com/excel-programming/348007-checking-whether-xls-file-just-opened-template.html)

BethA

Checking whether .xls file was just opened from a template
 
I would like to use in my Workbook_Open event handler the GetSaveAsFileName
method to have the user name the workbook. I want to "suggest" the file name
for the user (which would include the current date). But I only want to do
this when the file is created from my template. I don't want to do this every
time the workbook is opened.

I could do some kind of check on the current file name (to see if it's in
the "template1.xls" form), but that means changing code if we change the
template name. That's likely to happen since we may make 50 different version
for different customers. I'm hoping there's another way to check this.

Hope this makes sense! Any ideas? Thanks!

Beth A.

Tom Ogilvy

Checking whether .xls file was just opened from a template
 
If thisworkbook.path = "" then
fName = Application.GetSaveAsFilename . . .

--
Regards,
Tom Ogilvy


"BethA" wrote in message
...
I would like to use in my Workbook_Open event handler the

GetSaveAsFileName
method to have the user name the workbook. I want to "suggest" the file

name
for the user (which would include the current date). But I only want to do
this when the file is created from my template. I don't want to do this

every
time the workbook is opened.

I could do some kind of check on the current file name (to see if it's in
the "template1.xls" form), but that means changing code if we change the
template name. That's likely to happen since we may make 50 different

version
for different customers. I'm hoping there's another way to check this.

Hope this makes sense! Any ideas? Thanks!

Beth A.




BethA

Checking whether .xls file was just opened from a template
 
Thanks Tom - that's perfect! And I should have known that...

Beth A.

"Tom Ogilvy" wrote:

If thisworkbook.path = "" then
fName = Application.GetSaveAsFilename . . .

--
Regards,
Tom Ogilvy


"BethA" wrote in message
...
I would like to use in my Workbook_Open event handler the

GetSaveAsFileName
method to have the user name the workbook. I want to "suggest" the file

name
for the user (which would include the current date). But I only want to do
this when the file is created from my template. I don't want to do this

every
time the workbook is opened.

I could do some kind of check on the current file name (to see if it's in
the "template1.xls" form), but that means changing code if we change the
template name. That's likely to happen since we may make 50 different

version
for different customers. I'm hoping there's another way to check this.

Hope this makes sense! Any ideas? Thanks!

Beth A.






All times are GMT +1. The time now is 01:45 AM.

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