M
Mike
The following code is in a wrapper class (VB6) and is triggered when a
new inspector (contact) opens.
When setting objBar, the code pops an Error 91 [Object variable or
With block variable not set].
OlObject is equal to Outlook at the time of error.
Where am I going wrong?
Private Sub colInsp_NewInspector(ByVal Inspector As Inspector)
Dim objItem As Object
Set objInsp = Inspector
Set objItem = objInsp.CurrentItem
Select Case objItem.Class
Case olContact
Dim objBar As Office.CommandBar
Dim objButton As Office.CommandBarButton
*** Set objBar = OlObject.ActiveInspector.CommandBars.item("Standard")
Set objButton = objBar.Controls.item("Test Button")
If objButton Is Nothing Then
Set objButton = objBar.Controls.Add(msoControlButton,,,,True)
With objButton
.Visible = True
.BeginGroup = True
.FaceId = 1978
.Caption = "Test Button"
.Tag = "Test Button"
.Style = msoButtonIconAndCaption
End With
End If
End Select
Thanks
-mike
new inspector (contact) opens.
When setting objBar, the code pops an Error 91 [Object variable or
With block variable not set].
OlObject is equal to Outlook at the time of error.
Where am I going wrong?
Private Sub colInsp_NewInspector(ByVal Inspector As Inspector)
Dim objItem As Object
Set objInsp = Inspector
Set objItem = objInsp.CurrentItem
Select Case objItem.Class
Case olContact
Dim objBar As Office.CommandBar
Dim objButton As Office.CommandBarButton
*** Set objBar = OlObject.ActiveInspector.CommandBars.item("Standard")
Set objButton = objBar.Controls.item("Test Button")
If objButton Is Nothing Then
Set objButton = objBar.Controls.Add(msoControlButton,,,,True)
With objButton
.Visible = True
.BeginGroup = True
.FaceId = 1978
.Caption = "Test Button"
.Tag = "Test Button"
.Style = msoButtonIconAndCaption
End With
End If
End Select
Thanks
-mike