| 
                
Please start any new threads on our new 
    site at https://forums.sqlteam.com.  We've got lots of great SQL Server
    experts to answer whatever question you can come up with. 
    
        | 
                
                    | 
                            
                                | Author | Topic |  
                                    | MamathaPosting Yak  Master
 
 
                                        102 Posts | 
                                            
                                            |  Posted - 2005-02-09 : 01:35:54 
 |  
                                            | Hii want get all the sub menuitems of outlook menu.I know the code to get menu items and add a new menu,but i want to know the Tool menu sub menus.Please give me the solution,how can we find the sub menu items through VB6?My code is:Option ExplicitPrivate Function IsMenuThere(sMenu As String, _            sName As String) As Boolean  'Returns True if menu sName exists in sMenu.  Dim oCB As Office.CommandBar  'Dim oCB1 As Office.CommandBar    Dim oControl As Office.CommandBarControl   ' Dim oControl1 As Office.CommandBarControl        IsMenuThere = False  Set oCB = ActiveExplorer.CommandBars(sMenu)  For Each oControl In oCB.Controls  'Set oCB1 = ActiveExplorer.CommandBars(oControl.Caption)  'For Each oControl1 In oCB1.Controls  'MsgBox (oControl1.Caption)  'Next          If oControl.Caption = sName Then      IsMenuThere = True      Exit For    End If  Next  Set oCB = Nothing  Set oControl = NothingEnd FunctionPrivate Function AddMenu(sCBName As String, _  sName As String, sTag As String) As CommandBarControl  'Add the menu named in sName to the  'Outlook command bar named in sCBName.    Dim oBar As Office.CommandBar  Dim oControl As Office.CommandBarControl  Dim lCount As Long  Set oBar = ActiveExplorer.CommandBars(sCBName)  lCount = oBar.Controls.Count  With oBar    'A new menu is a popup control    'Add it before the Help menu, which is last, and make the menu temp    Set oControl = .Controls.Add(msoControlPopup, _      , , lCount - 1, True)        oControl.Caption = sName    'Any Tag must be unique    oControl.Tag = sTag  End With  Set AddMenu = oControl  Set oBar = Nothing  Set oControl = NothingEnd FunctionPublic Sub AddSMCMenu()  Dim oButton As Office.CommandBarButton  Dim oCB As Office.CommandBarPopup  Dim oBar As Office.CommandBar  Dim bResult As Boolean  'Add a Temp menu  bResult = IsMenuThere("Menu Bar", "&SMC")  If bResult = False Then    Set oCB = AddMenu("Menu Bar", "&SMC", "SMCTag")    With oCB    Set oButton = .Controls.Add(msoControlButton)      With oButton      .Caption = "Settings..."      .Tag = "Settings..."      .FaceId = 548      .HyperlinkType = msoCommandBarButtonHyperlinkOpen      .ToolTipText = App.Path & "\" & "Settings.exe"      .Style = msoButtonIconAndCaption    End With    End With      With oCB          Set oButton = .Controls.Add(msoControlButton)    With oButton      .BeginGroup = True      .Caption = "SMC WebSite..."      .Tag = "SMCwebSite"      .FaceId = 1015      .HyperlinkType = msoCommandBarButtonHyperlinkOpen      .ToolTipText = "http://www.croftssoftware.com"      .Style = msoButtonIconAndCaption    End With    End With  Else    Set oBar = ActiveExplorer.CommandBars("Menu Bar")    Set oCB = oBar.FindControl(, , "SMCTag")  End If    Set oButton = Nothing  Set oCB = Nothing  Set oBar = NothingEnd SubMamatha |  |  
                                    | jhermiz
 
 
                                    3564 Posts | 
                                        
                                          |  Posted - 2005-02-09 : 23:15:30 
 |  
                                          | dont know the answer but try the outlook forum (vba) at www.vbforums.combecome a member there, there are a lot of outlook experts. Keeping the web experience alive -- [url]http://www.web-impulse.com[/url]Imperfection living for perfection -- [url]http://jhermiz.blogspot.com/[/url]
 |  
                                          |  |  |  
                                |  |  |  |  |  |