H
Howard Kaikow
The code below runs correctly in Outlook 2003.
When I try to use the code in VB 6, or in Word 2003, I get an Error 91 on
the Set
cbrOutlookActiveMenuBar line.
The VB 6 project includes references to the Outlook and Office libraries.
What did I screw up?
----------------------------------------------------
Public Sub RunListOutlookControls()
Dim cbrOutlookActiveMenuBar As Office.CommandBar
Dim cbrOutlookTools As Office.CommandBarControl
Dim cbrOutlookToolsSend As Office.CommandBarControl
Dim appOutlook As Outlook.Application
Dim oCtl As Office.CommandBarControl
Set appOutlook = New Outlook.Application
Set cbrOutlookActiveMenuBar =
appOutlook.ActiveExplorer.CommandBars.ActiveMenuBar
Set cbrOutlookTools =
appOutlook.ActiveExplorer.CommandBars.ActiveMenuBar.Controls("Tools")
Set cbrOutlookToolsSend = cbrOutlookTools.Controls("Send/Receive")
MsgBox cbrOutlookToolsSend.Caption
appOutlook.Quit
Set appOutlook = Nothing
Set cbrOutlookActiveMenuBar = Nothing
Set cbrOutlookTools = Nothing
Set cbrOutlookToolsSend = Nothing
End Sub
When I try to use the code in VB 6, or in Word 2003, I get an Error 91 on
the Set
cbrOutlookActiveMenuBar line.
The VB 6 project includes references to the Outlook and Office libraries.
What did I screw up?
----------------------------------------------------
Public Sub RunListOutlookControls()
Dim cbrOutlookActiveMenuBar As Office.CommandBar
Dim cbrOutlookTools As Office.CommandBarControl
Dim cbrOutlookToolsSend As Office.CommandBarControl
Dim appOutlook As Outlook.Application
Dim oCtl As Office.CommandBarControl
Set appOutlook = New Outlook.Application
Set cbrOutlookActiveMenuBar =
appOutlook.ActiveExplorer.CommandBars.ActiveMenuBar
Set cbrOutlookTools =
appOutlook.ActiveExplorer.CommandBars.ActiveMenuBar.Controls("Tools")
Set cbrOutlookToolsSend = cbrOutlookTools.Controls("Send/Receive")
MsgBox cbrOutlookToolsSend.Caption
appOutlook.Quit
Set appOutlook = Nothing
Set cbrOutlookActiveMenuBar = Nothing
Set cbrOutlookTools = Nothing
Set cbrOutlookToolsSend = Nothing
End Sub