Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 30
Default requirement for creating a sub menu in c# excel addin

Dear All
I have a requirement for creating a sub menu. I have been
working on the addin and was able to put the addin in the tools menu
of excel. The menu will be something like:

1. Main Item
1.a. Sub item 1
1.a.i sub item 1
1.a.ii sub item 2
1.b. Sub item 1
1.b.i sub item 1
1.b.ii sub item 2

Can anybody help in creating this kind of menu formation in excel from
C# addin.

Regards
shantanu

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default requirement for creating a sub menu in c# excel addin

Here is an example

Sub MultiLevelMenus()
Dim oCb As CommandBar
Dim oCtl1 As CommandBarPopup
Dim oCtl2 As CommandBarPopup
Dim oCtl3 As CommandBarPopup
Dim oCtlBtn As CommandBarButton

Set oCb = Application.CommandBars("Worksheet Menu Bar")
With oCb
Set oCtl1 = .Controls("Tools").Controls.Add( _
Type:=msoControlPopup, _
temporary:=True)
oCtl1.Caption = "Level1"
With oCtl1
Set oCtlBtn = .Controls.Add( _
Type:=msoControlButton)
oCtlBtn.Caption = "Level1 Button1"
oCtlBtn.FaceId = 161
oCtlBtn.OnAction = "myLevel1Button1Macro"
With oCtl1
Set oCtl2 = .Controls.Add( _
Type:=msoControlPopup)
oCtl2.Caption = "Level2"
With oCtl2
Set oCtlBtn = .Controls.Add( _
Type:=msoControlButton)
oCtlBtn.Caption = "Level2 Button1"
oCtlBtn.FaceId = 161
oCtlBtn.OnAction = "myLevel2Button1Macro"
Set oCtl3 = .Controls.Add( _
Type:=msoControlPopup)
oCtl3.Caption = "Level3"
With oCtl3
Set oCtlBtn = .Controls.Add( _
Type:=msoControlButton)
oCtlBtn.Caption = "Level3 Button1"
oCtlBtn.FaceId = 161
oCtlBtn.OnAction = "myLevel3Button1Macro"
End With
End With
End With
'etc.
End With
End With
End Sub

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"shantanu" wrote in message
oups.com...
Dear All
I have a requirement for creating a sub menu. I have been
working on the addin and was able to put the addin in the tools menu
of excel. The menu will be something like:

1. Main Item
1.a. Sub item 1
1.a.i sub item 1
1.a.ii sub item 2
1.b. Sub item 1
1.b.i sub item 1
1.b.ii sub item 2

Can anybody help in creating this kind of menu formation in excel from
C# addin.

Regards
shantanu



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 30
Default requirement for creating a sub menu in c# excel addin

On May 1, 12:18 pm, "Bob Phillips" wrote:
Here is an example

Sub MultiLevelMenus()
Dim oCb As CommandBar
Dim oCtl1 As CommandBarPopup
Dim oCtl2 As CommandBarPopup
Dim oCtl3 As CommandBarPopup
Dim oCtlBtn As CommandBarButton

Set oCb = Application.CommandBars("Worksheet Menu Bar")
With oCb
Set oCtl1 = .Controls("Tools").Controls.Add( _
Type:=msoControlPopup, _
temporary:=True)
oCtl1.Caption = "Level1"
With oCtl1
Set oCtlBtn = .Controls.Add( _
Type:=msoControlButton)
oCtlBtn.Caption = "Level1 Button1"
oCtlBtn.FaceId = 161
oCtlBtn.OnAction = "myLevel1Button1Macro"
With oCtl1
Set oCtl2 = .Controls.Add( _
Type:=msoControlPopup)
oCtl2.Caption = "Level2"
With oCtl2
Set oCtlBtn = .Controls.Add( _
Type:=msoControlButton)
oCtlBtn.Caption = "Level2 Button1"
oCtlBtn.FaceId = 161
oCtlBtn.OnAction = "myLevel2Button1Macro"
Set oCtl3 = .Controls.Add( _
Type:=msoControlPopup)
oCtl3.Caption = "Level3"
With oCtl3
Set oCtlBtn = .Controls.Add( _
Type:=msoControlButton)
oCtlBtn.Caption = "Level3 Button1"
oCtlBtn.FaceId = 161
oCtlBtn.OnAction = "myLevel3Button1Macro"
End With
End With
End With
'etc.
End With
End With
End Sub

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"shantanu" wrote in message

oups.com...



Dear All
I have a requirement for creating a sub menu. I have been
working on the addin and was able to put the addin in the tools menu
of excel. The menu will be something like:


1. Main Item
1.a. Sub item 1
1.a.i sub item 1
1.a.ii sub item 2
1.b. Sub item 1
1.b.i sub item 1
1.b.ii sub item 2


Can anybody help in creating this kind of menu formation in excel from
C# addin.


Regards
shantanu- Hide quoted text -


- Show quoted text -


thanx for the code but can u get me in C# as i am not familiar with vb
reagrds
shantanu

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
add the addin in the Tools menu of Excel shantanu Excel Programming 6 February 22nd 07 04:30 AM
Creating Excel Addin salooha Excel Programming 6 June 28th 05 04:44 PM
Problems creating a dll in Excel 2003 using addin designer Tammy[_5_] Excel Programming 1 October 22nd 04 05:20 AM
Creating a new Excel Addin Michael Lawrence Jr. Excel Programming 1 December 17th 03 10:30 PM
Excel Addin with drop-down menu Aparna Rege Excel Programming 1 July 14th 03 11:00 PM


All times are GMT +1. The time now is 10:20 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"