Hi All,
I'm just a noob to VBA so i need some help which may be obvious.
I need to run a macro when save / saveas is used within WorkbookX. got
that part worked out,
but it tries to run in other workbooks that are also open, which I
don't want it to, because it is referring to sheets that only exist in
WorkbookX. Here's the code from WorkbookX
Sub Workbook_Open()
Application.CommandBars("Standard").Controls("&Save").OnAction =
"MySave"
Application.CommandBars("Worksheet Menu
Bar").Controls("File").Controls("Save").OnAction = "MySave"
Application.CommandBars("Worksheet Menu
Bar").Controls("File").Controls("Save As...").OnAction = "MySaveAs"
End Sub
Sub Workbook_BeforeClose(Cancel As Boolean)
Application.CommandBars("Standard").Controls("&Save").OnAction = ""
Application.CommandBars("Worksheet Menu
Bar").Controls("File").Controls("Save").OnAction = ""
Application.CommandBars("Worksheet Menu
Bar").Controls("File").Controls("Save As...").OnAction = ""
End Sub
So how do I limit this working to just WorkbookX - while still allowing
the user to change WorkbookX's name using SaveAs?
thanks
Paul
Bookmarks