Script error: Object required

  • Thread starter Thread starter mcgrew.michael
  • Start date Start date
M

mcgrew.michael

When tring to open a custom form that adds a button to the standard
toolbar i get the following error:

Object required: 'objInspector' Line No:6

Below is the code:

Function Item_Open()
Dim objInspector
Dim objCommandbar
Dim objButton
Set objInspector = Item.Application.ActiveInspector
Set objCommandbar = objInspector.CommandBars.Item("Standard")
Set objButton = objCommandbar.Controls.Add

With objButton
.ToolTipText = "Send Secure"
.FaceID = 42
.Tag = "Send Secure"
.Caption = "Send Secure"
.OnAction = "SendSecure"
End With

End Function

Sub SendSecure()
Item.Subject = "#secure"
Item.Send
End Sub

Anyone have any idea why?
 
To get the Inspector for the item where the code is running, use:

Set objInspector = Item.GetInspector

Note, though, that you can't get a toolbar button to run code from a form. You can, however, put a command button on your form to run code.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
Back
Top