ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Probably a stupid question. Get workbook name. (https://www.excelbanter.com/excel-programming/385572-probably-stupid-question-get-workbook-name.html)

Rominall

Probably a stupid question. Get workbook name.
 
I have a workbook opens and closes other workbooks so I need to reference the
'master' workbook. However, there are points during code run that the user
can save the file as a different name and I don't want to keep them from
doing that. Problem, they can also change the other workbook names too. For
the other workbooks I don't care if they can or can't change the file name.

Question: What is the easiest way to capture when a user does a save as?
And is there a way to have a msgbox/error box pop up so they know exactly
which workbook they are saving?

I have no control over naming conventions and I have been hit with very
similiar file names which has confused the users.

Problem: I use screenupdating off, so there are a few spots where it looks
like one of the other workbooks is open when it's really the master workbook.

Charles Chickering

Probably a stupid question. Get workbook name.
 
You could create a variable then do the save as on that:
Dim wb As Workbook
Dim SvNm As String
Set wb = Worbooks.Open("C:\Book1.xls")
SvNm = Application.GetSaveAsFilename("C:\","Excel Files, _
*.xls",0,"Select File Name","Save")
wb.SaveAs Filename:=SvName
--
Charles Chickering

"A good example is twice the value of good advice."


"Rominall" wrote:

I have a workbook opens and closes other workbooks so I need to reference the
'master' workbook. However, there are points during code run that the user
can save the file as a different name and I don't want to keep them from
doing that. Problem, they can also change the other workbook names too. For
the other workbooks I don't care if they can or can't change the file name.

Question: What is the easiest way to capture when a user does a save as?
And is there a way to have a msgbox/error box pop up so they know exactly
which workbook they are saving?

I have no control over naming conventions and I have been hit with very
similiar file names which has confused the users.

Problem: I use screenupdating off, so there are a few spots where it looks
like one of the other workbooks is open when it's really the master workbook.



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

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