Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Menu Item name

I need a code to add a custom menu to worksheet menu bar and populate it with
the sheet name in the workbook. Further, if one clicks the particular sheet
name, only that particular sheet should be visible.
I tried populating the menu with sheet name in the workbook, however, I am
unable to do the later.
Any suggestions..



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,253
Default Menu Item name



you'll want the "Workbook Tabs" popup..

Normally you'd rightclick the arrows in the bottomleft
part of a window.. but you can add it to the menu bar
like:


Sub CreateMenu_Navigator()
Const MYTAG = "WBT"
With CommandBars
While Not .FindControl(Tag:=MYTAG) Is Nothing
.FindControl(Tag:=MYTAG).Delete
Wend
End With
With CommandBars("Worksheet Menu Bar")
With .Controls.Add(msoControlPopup, temporary:=True)
.Tag = MYTAG
.Caption = "Navigator"
.OnAction = "showWBT"
End With
End With

End Sub

Sub showWBT()
CommandBars("Workbook Tabs").ShowPopup
End Sub




--
keepITcool
| www.XLsupport.com | keepITcool chello nl | amsterdam


Christopher Sequeira wrote :

I need a code to add a custom menu to worksheet menu bar and populate
it with the sheet name in the workbook. Further, if one clicks the
particular sheet name, only that particular sheet should be visible.
I tried populating the menu with sheet name in the workbook, however,
I am unable to do the later.
Any suggestions..

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,080
Default Menu Item name

Hi keepITcool:

I think the OP wanted something slightly different, so I've modified your
code a little bit as follows:

Option Explicit

Sub CreateMenu_Navigator()
Const MYTAG = "WBT"
With CommandBars
While Not .FindControl(Tag:=MYTAG) Is Nothing
.FindControl(Tag:=MYTAG).Delete
Wend
End With
With CommandBars("Worksheet Menu Bar")
With .Controls.Add(msoControlPopup, temporary:=True)
.Tag = MYTAG
.Caption = "Navigator"
.OnAction = "ListSheets"
End With
End With
End Sub

Sub ShowSheetListMenu()
Dim ws As Worksheet
Application.ScreenUpdating = False
With Worksheets(CommandBars.ActionControl.Caption)
.Visible = True
.Activate
End With
For Each ws In Worksheets
If Not ws Is ActiveSheet Then ws.Visible = False
Next
Application.ScreenUpdating = True
End Sub

Sub ListSheets()
Dim ws As Worksheet, ctl As CommandBarControl
With CommandBars(1).Controls("Navigator")
For Each ctl In .Controls
ctl.Delete
Next
End With
For Each ws In Worksheets
With CommandBars(1).Controls("Navigator")
.Controls.Add.Caption = ws.Name
.Controls(ws.Name).OnAction = "ShowSheetListMenu"
End With
Next
End Sub


I'm sure it could be streamlined substantially, but I didn't want to spend
too much time on it if I wasn't on the right track.

Regards,

Vasant

"keepITcool" wrote in message
ft.com...


you'll want the "Workbook Tabs" popup..

Normally you'd rightclick the arrows in the bottomleft
part of a window.. but you can add it to the menu bar
like:


Sub CreateMenu_Navigator()
Const MYTAG = "WBT"
With CommandBars
While Not .FindControl(Tag:=MYTAG) Is Nothing
.FindControl(Tag:=MYTAG).Delete
Wend
End With
With CommandBars("Worksheet Menu Bar")
With .Controls.Add(msoControlPopup, temporary:=True)
.Tag = MYTAG
.Caption = "Navigator"
.OnAction = "showWBT"
End With
End With

End Sub

Sub showWBT()
CommandBars("Workbook Tabs").ShowPopup
End Sub




--
keepITcool
| www.XLsupport.com | keepITcool chello nl | amsterdam


Christopher Sequeira wrote :

I need a code to add a custom menu to worksheet menu bar and populate
it with the sheet name in the workbook. Further, if one clicks the
particular sheet name, only that particular sheet should be visible.
I tried populating the menu with sheet name in the workbook, however,
I am unable to do the later.
Any suggestions..



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Menu Item name

Thanks Vasant

It worked. This was what i was looking for.
I should say that this is the best place for any begineer to get maximum
knowledge and assistance from people like you.
Thanks once again.
And is there a personal mail I could get in touch with you in future, as
there is lots to learn in excel programming and its fun too.

Regards,
Christopher


"Vasant Nanavati" wrote:

Hi keepITcool:

I think the OP wanted something slightly different, so I've modified your
code a little bit as follows:

Option Explicit

Sub CreateMenu_Navigator()
Const MYTAG = "WBT"
With CommandBars
While Not .FindControl(Tag:=MYTAG) Is Nothing
.FindControl(Tag:=MYTAG).Delete
Wend
End With
With CommandBars("Worksheet Menu Bar")
With .Controls.Add(msoControlPopup, temporary:=True)
.Tag = MYTAG
.Caption = "Navigator"
.OnAction = "ListSheets"
End With
End With
End Sub

Sub ShowSheetListMenu()
Dim ws As Worksheet
Application.ScreenUpdating = False
With Worksheets(CommandBars.ActionControl.Caption)
.Visible = True
.Activate
End With
For Each ws In Worksheets
If Not ws Is ActiveSheet Then ws.Visible = False
Next
Application.ScreenUpdating = True
End Sub

Sub ListSheets()
Dim ws As Worksheet, ctl As CommandBarControl
With CommandBars(1).Controls("Navigator")
For Each ctl In .Controls
ctl.Delete
Next
End With
For Each ws In Worksheets
With CommandBars(1).Controls("Navigator")
.Controls.Add.Caption = ws.Name
.Controls(ws.Name).OnAction = "ShowSheetListMenu"
End With
Next
End Sub


I'm sure it could be streamlined substantially, but I didn't want to spend
too much time on it if I wasn't on the right track.

Regards,

Vasant

"keepITcool" wrote in message
ft.com...


you'll want the "Workbook Tabs" popup..

Normally you'd rightclick the arrows in the bottomleft
part of a window.. but you can add it to the menu bar
like:


Sub CreateMenu_Navigator()
Const MYTAG = "WBT"
With CommandBars
While Not .FindControl(Tag:=MYTAG) Is Nothing
.FindControl(Tag:=MYTAG).Delete
Wend
End With
With CommandBars("Worksheet Menu Bar")
With .Controls.Add(msoControlPopup, temporary:=True)
.Tag = MYTAG
.Caption = "Navigator"
.OnAction = "showWBT"
End With
End With

End Sub

Sub showWBT()
CommandBars("Workbook Tabs").ShowPopup
End Sub




--
keepITcool
|
www.XLsupport.com | keepITcool chello nl | amsterdam


Christopher Sequeira wrote :

I need a code to add a custom menu to worksheet menu bar and populate
it with the sheet name in the workbook. Further, if one clicks the
particular sheet name, only that particular sheet should be visible.
I tried populating the menu with sheet name in the workbook, however,
I am unable to do the later.
Any suggestions..




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,080
Default Menu Item name

Glad to help.

I am not able to respond to help requests via private email. In any event,
you will get much better answers by posting here, as there is such a vast
wealth of expertrise available.

--

Vasant



"Christopher Sequeira" wrote
in message ...
Thanks Vasant

It worked. This was what i was looking for.
I should say that this is the best place for any begineer to get maximum
knowledge and assistance from people like you.
Thanks once again.
And is there a personal mail I could get in touch with you in future, as
there is lots to learn in excel programming and its fun too.

Regards,
Christopher


"Vasant Nanavati" wrote:

Hi keepITcool:

I think the OP wanted something slightly different, so I've modified

your
code a little bit as follows:

Option Explicit

Sub CreateMenu_Navigator()
Const MYTAG = "WBT"
With CommandBars
While Not .FindControl(Tag:=MYTAG) Is Nothing
.FindControl(Tag:=MYTAG).Delete
Wend
End With
With CommandBars("Worksheet Menu Bar")
With .Controls.Add(msoControlPopup, temporary:=True)
.Tag = MYTAG
.Caption = "Navigator"
.OnAction = "ListSheets"
End With
End With
End Sub

Sub ShowSheetListMenu()
Dim ws As Worksheet
Application.ScreenUpdating = False
With Worksheets(CommandBars.ActionControl.Caption)
.Visible = True
.Activate
End With
For Each ws In Worksheets
If Not ws Is ActiveSheet Then ws.Visible = False
Next
Application.ScreenUpdating = True
End Sub

Sub ListSheets()
Dim ws As Worksheet, ctl As CommandBarControl
With CommandBars(1).Controls("Navigator")
For Each ctl In .Controls
ctl.Delete
Next
End With
For Each ws In Worksheets
With CommandBars(1).Controls("Navigator")
.Controls.Add.Caption = ws.Name
.Controls(ws.Name).OnAction = "ShowSheetListMenu"
End With
Next
End Sub


I'm sure it could be streamlined substantially, but I didn't want to

spend
too much time on it if I wasn't on the right track.

Regards,

Vasant

"keepITcool" wrote in message
ft.com...


you'll want the "Workbook Tabs" popup..

Normally you'd rightclick the arrows in the bottomleft
part of a window.. but you can add it to the menu bar
like:


Sub CreateMenu_Navigator()
Const MYTAG = "WBT"
With CommandBars
While Not .FindControl(Tag:=MYTAG) Is Nothing
.FindControl(Tag:=MYTAG).Delete
Wend
End With
With CommandBars("Worksheet Menu Bar")
With .Controls.Add(msoControlPopup, temporary:=True)
.Tag = MYTAG
.Caption = "Navigator"
.OnAction = "showWBT"
End With
End With

End Sub

Sub showWBT()
CommandBars("Workbook Tabs").ShowPopup
End Sub




--
keepITcool
|
www.XLsupport.com | keepITcool chello nl | amsterdam


Christopher Sequeira wrote :

I need a code to add a custom menu to worksheet menu bar and

populate
it with the sheet name in the workbook. Further, if one clicks the
particular sheet name, only that particular sheet should be visible.
I tried populating the menu with sheet name in the workbook,

however,
I am unable to do the later.
Any suggestions..








Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Menu items added with menu item editor in older versions Michael Hoffmann Excel Discussion (Misc queries) 2 January 7th 05 01:40 PM
Adding a menu item right click menu when clicking on a single. Andoni[_28_] Excel Programming 0 September 2nd 04 10:23 PM
Enabling a menu item MoonWeazel[_2_] Excel Programming 2 July 7th 04 11:54 AM
Disable Menu Item OCI Excel Programming 0 May 19th 04 05:41 PM
New menu bar item Juan[_3_] Excel Programming 3 May 15th 04 10:43 AM


All times are GMT +1. The time now is 09:08 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"