ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Toolbar to launch Macros (https://www.excelbanter.com/excel-programming/424731-toolbar-launch-macros.html)

Fan924

Toolbar to launch Macros
 
I have created a customized Toolbar to launch Macros , a procedure by
Dave Peterson. Adds a nice professional touch.
http://www.contextures.com/xlToolbar02.html#Setup
I need to limit the macro only to a few sheets. Can I add code to
"Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)"
that will enable or disable my toolbar macro?

curlydave

Toolbar to launch Macros
 
Try the workbook module instead

Private Sub Workbook_SheetActivate(ByVal Sh As Object)
If ActiveSheet.Name = "Sheet1" Or ActiveSheet.Name = "Sheet2" Then
MsgBox "Your toolBar Macro Here" 'change to Call CreateMenubar
End If
End Sub

Private Sub Workbook_SheetDeactivate(ByVal Sh As Object)
MsgBox "Your remove toolbar Macro Here" ' change to Call RemoveMenubar
End Sub

Gary Keramidas[_2_]

Toolbar to launch Macros
 
I'll just use something like this in the sheet code mdules:

Private Sub Worksheet_Deactivate()
RemoveToolbar ' this is contains code that removes the toolbar
End Sub

and

Private Sub Worksheet_Deactivate()
CreateToolbar ' this module contains code to create the toolbar
End Sub
--


Gary K



"Fan924" wrote in message
...
I have created a customized Toolbar to launch Macros , a procedure by
Dave Peterson. Adds a nice professional touch.
http://www.contextures.com/xlToolbar02.html#Setup
I need to limit the macro only to a few sheets. Can I add code to
"Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)"
that will enable or disable my toolbar macro?



Fan924

Toolbar to launch Macros
 
Thanks guys. I guess i didn't study it long enough. The downloaded
from the link above contained the following.
Sub RemoveMenubar()
Sub CreateMenubar()
Now it turns on and off when I select a sheet. Looking good.

The toolbar pops up in the middle of the page and not with the other
menus at the top.
Any way to fix that?

Fan924

Toolbar to launch Macros
 
Got it
..Position = msoBarFloat
change to
..Position = msoBarTop


All times are GMT +1. The time now is 05:55 PM.

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