Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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("&Sav e").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("&Sav e").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 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Macro in 2nd Open workbook | Excel Discussion (Misc queries) | |||
run macro on workbook open | Excel Discussion (Misc queries) | |||
how can I run a macro when I open a workbook? | Excel Discussion (Misc queries) | |||
Macro to open another workbook | Excel Programming | |||
Open & run a workbook macro. | Excel Programming |