Toolbars and customising

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Excel helper

I wrote some code in VBA and then customised my toolbar so that in the
<Data> dropdown there was an entry that would activate my code.

I then saved my file and all is fine.

The problem: I only want the entry in the Data menu on the toolbar to appear
when I open that specific workbook. At the minute the entry appears in every
excel workbook that I use.

How do I save an excel workbook so that the toolbar is specific tot hat
workbook? Do I need to use an .xlb extension.

Also I wrote my code as Public sub MyCode(). If I instead use Private will
that solve the problem.?

Any help would be appreciated.

Regards


Alex
 
Hi Alex

Normal you customised on activate and restore when you deactivate the workbook

Use this two events in the Thisworkbook module.

Read more about events on Chip Pearson's site.
http://www.cpearson.com/excel/events.htm


Private Sub Workbook_Activate()
'your code to customise
End Sub

Private Sub Workbook_Deactivate()
'your code to restore
End Sub
 

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