View Single Post
  #5  
Old April 28th 09, 07:11 PM posted to microsoft.public.outlook.program_vba
Christopher Slowik
external usenet poster
 
Posts: 5
Default Custom Form and firing Revise Contents button

Hi Ken,

No the MsgBox fires. Here is the changed code.

Dim objInsp
Dim objCB
'On Error Resume Next
Set objInsp = Item.GetInspector
Set objCB = objInsp.CommandBars
If Not objCB Is Nothing Then
MsgBox "Here we are with objCB"
objCB.ExecuteMso("ReviseContents")
End If

Set objInsp = Nothing
Set objCB = Nothing

the line "objCB.ExecuteMso("ReviseContents")" throws the following error:

Invalid procedure call or argument
Line No:11

"Ken Slovak - [MVP - Outlook]" wrote:

Are you saying the MsgBox doesn't fire or something else?

In some cases things are only weak object references at the time the
Item_Open() event fires in form code.

In an addin I'd get those things in the first Inspector.Activate() event
handler, but that can't be done in form code. I also sometimes use a timer
to wait out the completion of an event, but again that can't be done in form
code.

I'd comment out the On Error line and see what line fires an error. In
addition, I'd also set up a CommandBars object and instantiate that as
objInsp.CommandBars, then if that was valid I'd call ExecuteMso() on that
object.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"Christopher Slowik" wrote in
message ...
Ken, thanks for the information. I still cannot get this to fire. As a
test, I created a standard Post Item in a test folder. Placed the code
below
in the Item_Open event but it never seems to fire.

MsgBox "Here we are"
Dim objInsp
On Error Resume Next
Set objInsp = Item.GetInspector
objInsp.CommandBars.ExecuteMso("ReviseContents")
Set objInsp = Nothing

Thanks



Ads