ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Checking FileName (https://www.excelbanter.com/excel-discussion-misc-queries/39459-checking-filename.html)

andy

Checking FileName
 
I want to have a macro that is utilised when my workbook is opened. What I
need it to do is, look at the current filename, if it is still the same as
the template filename, then bring up a message box that will have the option
of going to the save as.. function, or clicking cancel will just open the
book as normal.

If however, the name has changed from the original title, then it will just
load up without having a message box.

Any help will be greatly appreciated.

Earl Kiosterud

Andy,

If you're really using an Excel template (saved as a template -- xlt file
extension), you won't need to do any of this. You create a new workbook
based on the template (File - New - from template -- varies with your
version of Excel), do your work, then save that workbook. The template
won't be overlaid unless the user uses File - Save as, and specifies
template. You can mark it read-only to help prevent that.
--
Earl Kiosterud
www.smokeylake.com

"andy" wrote in message
...
I want to have a macro that is utilised when my workbook is opened. What I
need it to do is, look at the current filename, if it is still the same as
the template filename, then bring up a message box that will have the
option
of going to the save as.. function, or clicking cancel will just open the
book as normal.

If however, the name has changed from the original title, then it will
just
load up without having a message box.

Any help will be greatly appreciated.




andy

It is a template that I made myself for others to use (it isn't one of the
pre-made excel templates), which they open, use the save as.. function to
save it as the correct w/ending date. The only problem is the people using it
aren't really paying attention and changing parts of the template, and then
saving over the template. I want to do it this way to make sure that they
have to use the save as.. function and don't edit the original.

"Earl Kiosterud" wrote:

Andy,

If you're really using an Excel template (saved as a template -- xlt file
extension), you won't need to do any of this. You create a new workbook
based on the template (File - New - from template -- varies with your
version of Excel), do your work, then save that workbook. The template
won't be overlaid unless the user uses File - Save as, and specifies
template. You can mark it read-only to help prevent that.
--
Earl Kiosterud
www.smokeylake.com

"andy" wrote in message
...
I want to have a macro that is utilised when my workbook is opened. What I
need it to do is, look at the current filename, if it is still the same as
the template filename, then bring up a message box that will have the
option
of going to the save as.. function, or clicking cancel will just open the
book as normal.

If however, the name has changed from the original title, then it will
just
load up without having a message box.

Any help will be greatly appreciated.





Earl Kiosterud

Andy,

I'm still not sure we're talking about the same things. Does this
"template" have the extension .xls? Or is it .xlt? Do you open it as a
regular .xls file. Or do you open it changing the requested file type to
..xlt?
"andy" wrote in message
...
It is a template that I made myself for others to use (it isn't one of the
pre-made excel templates), which they open, use the save as.. function to
save it as the correct w/ending date. The only problem is the people using
it
aren't really paying attention and changing parts of the template, and
then
saving over the template. I want to do it this way to make sure that they
have to use the save as.. function and don't edit the original.

"Earl Kiosterud" wrote:

Andy,

If you're really using an Excel template (saved as a template -- xlt file
extension), you won't need to do any of this. You create a new workbook
based on the template (File - New - from template -- varies with your
version of Excel), do your work, then save that workbook. The template
won't be overlaid unless the user uses File - Save as, and specifies
template. You can mark it read-only to help prevent that.
--
Earl Kiosterud
www.smokeylake.com

"andy" wrote in message
...
I want to have a macro that is utilised when my workbook is opened. What
I
need it to do is, look at the current filename, if it is still the same
as
the template filename, then bring up a message box that will have the
option
of going to the save as.. function, or clicking cancel will just open
the
book as normal.

If however, the name has changed from the original title, then it will
just
load up without having a message box.

Any help will be greatly appreciated.







andy

Don't worry about the whole template part, it has nothing to do with it, I
just need help with the visual basic side of it, as asked for in my original
post. It basically needs to:

1. Look at workbook filename.
2. If it is equal to a certain filename, then bring up a message box.
3. Have one button link to the Save As.. function.
4. Have one button to just cancel, and enter the workbook.
5. If the workbook has a different name, then have it just open the workbook
without the messagebox.




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

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