Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
File name
I have a template which users can save as etc. I would like to know how I
can get the name of the file. The workbook has an auto open and asks if you would like to update the file. I only want this to appear in the template. So if I were to open myfile.xls the autoopen would be If currentworkbook filename < mytemplate then exit. Not sure of how I obtain the filename. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
File name
If Activeworkbook.Name < mytemplate Then Exit Sub
-- __________________________________ HTH Bob "Rpettis31" wrote in message ... I have a template which users can save as etc. I would like to know how I can get the name of the file. The workbook has an auto open and asks if you would like to update the file. I only want this to appear in the template. So if I were to open myfile.xls the autoopen would be If currentworkbook filename < mytemplate then exit. Not sure of how I obtain the filename. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
File name
If the template file was used to create a new workbook, not opened as a template
(*.xlt), you could check the path. sub auto_open() if thisworkbook.path = "" then 'it hasn't been saved yet, you're working in a new workbook else 'it's been saved at least once. end if end sub or in the workbook_open event Private Sub Workbook_Open() if me.path = "" then 'it hasn't been saved yet, you're working in a new workbook else 'it's been saved at least once. end if end sub The Me keyword refers to the object that owns the code--in this case, it's the ThisWorkbook module. Rpettis31 wrote: I have a template which users can save as etc. I would like to know how I can get the name of the file. The workbook has an auto open and asks if you would like to update the file. I only want this to appear in the template. So if I were to open myfile.xls the autoopen would be If currentworkbook filename < mytemplate then exit. Not sure of how I obtain the filename. -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
File:1 and File:2 -- Double Files when Opening One File | Excel Discussion (Misc queries) | |||
I saved file A over file B. Can I get file B back? | Excel Discussion (Misc queries) | |||
opening an excel file opens a duplicate file of the same file | Excel Discussion (Misc queries) | |||
I SAVED A FILE OVER ANOTHER A FILE IN EXCEL. THE OLD FILE WAS AN . | Excel Discussion (Misc queries) | |||
i received a file that reads powerpoint document file file exten. | Excel Discussion (Misc queries) |