ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Toolbars and customising (https://www.excelbanter.com/excel-discussion-misc-queries/54276-toolbars-customising.html)

Alex

Toolbars and customising
 
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

Ron de Bruin

Toolbars and customising
 
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





--
Regards Ron de Bruin
http://www.rondebruin.nl


"Alex" wrote in message ...
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




Alex

Toolbars and customising
 
Ron de Bruin

Thanks for that. I'll try that.

Regards

Alex

"Ron de Bruin" wrote:

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





--
Regards Ron de Bruin
http://www.rondebruin.nl


"Alex" wrote in message ...
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






All times are GMT +1. The time now is 03:34 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com