Custom Toolbars and Relative Macros

  • Thread starter Thread starter schorley
  • Start date Start date
S

schorley

Hi

I've made a custom toolbar, EGI, which has two buttons on it. The
toolbar is attached to the workbook.
However, the workbook is only a template workbook, so many copies of
it will be made. When this happens the toolbar buttons relate to the
original (template) workbook.

How can I make the buttons be 'relative' to the workbooks?

Thanks!
 
Assign the macros in the Workbook_Open event


Private Sub Workbook_Open()
With Application.Commandbars("MyBar")
.Controls("Ctl1").OnAction = "myMacro1"
.Controls("Ctl2").OnAction = "myMacro2"
End With
End Sub

'This is workbook event code.
'To input this code, right click on the Excel icon on the worksheet
'(or next to the File menu if you maximise your workbooks),
'select View Code from the menu, and paste the code


--
---
HTH

Bob

(change the xxxx to gmail if mailing direct)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top