Custom Buttons linked to Macros

S

surveyorinva

This is fustrating...
I have made a custom menu based upon macros that I have in a worksheet. This worksheet is a file which will be saved using a different names at any given time. When I use the custom menu based upon the macros in the first saved file it works. When I go back to the "template" file and do another save as, when I try using the custom menu, it trys looking for the macros in the previous saved file instead of looking at the macros in the just saved file. Can this be fixed to where it will what ever the file name is not try and cross link to another set of macros but use the one in the file?
Any help would be great! Thanks in advance
 
G

Greg Koppel

Assign/unassign on open/close. Below is example for toolbar.

Sub Auto_open()
Toolbars("LogForm").Visible = True
Toolbars("LogForm").ToolbarButtons(1).OnAction = "PhoneLogger"
Toolbars("LogForm").ToolbarButtons(2).OnAction = "LateLogger"
End Sub
Sub Auto_close()
On Error Resume Next
Toolbars("LogForm").ToolbarButtons(1).OnAction = ""
Toolbars("LogForm").ToolbarButtons(2).OnAction = ""
Toolbars("LogForm").Visible = False

Toolbars("LogForm").Delete
On Error GoTo 0
End Sub

HTH, Greg

surveyorinva said:
This is fustrating...
I have made a custom menu based upon macros that I have in a worksheet.
This worksheet is a file which will be saved using a different names at any
given time. When I use the custom menu based upon the macros in the first
saved file it works. When I go back to the "template" file and do another
save as, when I try using the custom menu, it trys looking for the macros in
the previous saved file instead of looking at the macros in the just saved
file. Can this be fixed to where it will what ever the file name is not try
and cross link to another set of macros but use the one in the file?
 
Top