Script error: Object required

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?
 
S

Sue Mosher [MVP-Outlook]

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top