![]() |
Custom Form and firing Revise Contents button
Hi,
We have a custom form that creates a post in a public folder. In Outlook 2007, when a user opens a posting in this folder, they cannot edit the body of the post until they click the "Revise Contents" button. I'd like to execute this button on the Item_Open event so they do not have to click this manually. I have the code below, but nothing seems to happen: Dim objInsp Dim colCB Dim objCBB On Error Resume Next Set objInsp = Item.GetInspector Set colCB = objInsp.CommandBars Set objCBB = colCB.FindControl(, 3273) If Not objCBB Is Nothing Then 'MsgBox objCBB.Caption objCBB.Execute End If Set objCBB = Nothing Set colCB = Nothing Set objInsp = Nothing Thanks for any help -Chris |
Custom Form and firing Revise Contents button
In the Outlook 2007 Ribbon that ribbon control has an idMso of
"ReviseContents". Use Inspector.CommandBars.ExecuteMso("ReviseContents") on open to do what you want. -- 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 ... Hi, We have a custom form that creates a post in a public folder. In Outlook 2007, when a user opens a posting in this folder, they cannot edit the body of the post until they click the "Revise Contents" button. I'd like to execute this button on the Item_Open event so they do not have to click this manually. I have the code below, but nothing seems to happen: Dim objInsp Dim colCB Dim objCBB On Error Resume Next Set objInsp = Item.GetInspector Set colCB = objInsp.CommandBars Set objCBB = colCB.FindControl(, 3273) If Not objCBB Is Nothing Then 'MsgBox objCBB.Caption objCBB.Execute End If Set objCBB = Nothing Set colCB = Nothing Set objInsp = Nothing Thanks for any help -Chris |
Custom Form and firing Revise Contents button
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 "Ken Slovak - [MVP - Outlook]" wrote: In the Outlook 2007 Ribbon that ribbon control has an idMso of "ReviseContents". Use Inspector.CommandBars.ExecuteMso("ReviseContents") on open to do what you want. -- 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 ... Hi, We have a custom form that creates a post in a public folder. In Outlook 2007, when a user opens a posting in this folder, they cannot edit the body of the post until they click the "Revise Contents" button. I'd like to execute this button on the Item_Open event so they do not have to click this manually. I have the code below, but nothing seems to happen: Dim objInsp Dim colCB Dim objCBB On Error Resume Next Set objInsp = Item.GetInspector Set colCB = objInsp.CommandBars Set objCBB = colCB.FindControl(, 3273) If Not objCBB Is Nothing Then 'MsgBox objCBB.Caption objCBB.Execute End If Set objCBB = Nothing Set colCB = Nothing Set objInsp = Nothing Thanks for any help -Chris |
Custom Form and firing Revise Contents button
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 |
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 |
Custom Form and firing Revise Contents button
Just for fun try it with this line instead:
objCB.ExecuteMso "ReviseContents" Of course this will only run without error on Outlook 2007... -- 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 ... 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 |
Custom Form and firing Revise Contents button
Same message Ken.....Invalid Procedure call or argument.
I'm stumped "Ken Slovak - [MVP - Outlook]" wrote: Just for fun try it with this line instead: objCB.ExecuteMso "ReviseContents" Of course this will only run without error on Outlook 2007... -- 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 ... 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 |
Custom Form and firing Revise Contents button
Let me check this out tomorrow and see what's going on.
-- 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 ... Same message Ken.....Invalid Procedure call or argument. I'm stumped |
Custom Form and firing Revise Contents button
Great....thanks Ken
"Ken Slovak - [MVP - Outlook]" wrote: Let me check this out tomorrow and see what's going on. -- 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 ... Same message Ken.....Invalid Procedure call or argument. I'm stumped |
Custom Form and firing Revise Contents button
It looks like the added methods in the CommandBars collection aren't
available at all in Item_Open, either in form code or in Outlook VBA. They are available when the first Inspector.Activate() event fires. I hit an error both in the form code and Outlook VBA when I called CommandBars.ExecuteMso() in Item_Open. I didn't in the first Inspector.Activate() on that Inspector, however that's not an event you can sink in form code. The other gotcha related to this is that calling ExecuteMso("ReviseContents") will open a new Inspector and close the existing one (same item, but now in edit mode). So any Activate() code would have to account for that since both NewInspector() and Inspector.Activate() will fire again when that new Inspector is opened. -- 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 ... Great....thanks Ken |
All times are GMT +1. The time now is 05:07 PM. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2006 OutlookBanter.com