Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Software > Developer Outlook Addins > Can't put a but...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 5 Topic 1641 of 1746
Post > Topic >>

Can't put a button on a Contact toolbar

by Mike <diespam@[EMAIL PROTECTED] > Dec 14, 2007 at 05:31 PM

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
 




 5 Posts in Topic:
Can't put a button on a Contact toolbar
Mike <diespam@[EMAIL P  2007-12-14 17:31:46 
Re: Can't put a button on a Contact toolbar
"Ken Slovak - [MVP -  2007-12-15 12:43:21 
Re: Can't put a button on a Contact toolbar
Mike <diespam@[EMAIL P  2007-12-15 18:33:19 
Re: Can't put a button on a Contact toolbar
"Mark J. McGinty&quo  2007-12-16 16:40:16 
Re: Can't put a button on a Contact toolbar
Mike <diespam@[EMAIL P  2007-12-16 20:19:17 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Mon Dec 1 14:49:38 CST 2008.