troubleshooting Question

Excel VBA: Define current workbook in VBA

Avatar of ouestque
ouestqueFlag for United States of America asked on
Microsoft Excel
11 Comments2 Solutions1273 ViewsLast Modified:
What VBA code would I need so that it will store the current workbooks name in a public variable. (Even after a "Save As...")

Here is what I am thinking of...

i.e. In a module I might have...
--->Public Current_Worksheet_Name as String

i.e. When the workbook opens I might have...
--->Current_Worksheet_Name = ""

This is usually fine, but what if the user save's the worksheet under a different name while it is still open. i.e. user Goes to File--->Save As.... --->Name="NewWorksheetName"

In this case the public variable should update to: "NewWorksheetName"
BUT... there is not a after_SaveAs event in Excel 2003. Any ideas? hmmm...
Join our community to see this answer!
Unlock 2 Answers and 11 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 11 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros