A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Custom Form and firing Revise Contents button



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old April 23rd 09, 02:59 PM posted to microsoft.public.outlook.program_vba
Christopher Slowik
external usenet poster
 
Posts: 5
Default 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

Ads
  #2  
Old April 24th 09, 02:19 PM posted to microsoft.public.outlook.program_vba
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default 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


  #3  
Old April 28th 09, 05:04 PM posted to microsoft.public.outlook.program_vba
Christopher Slowik
external usenet poster
 
Posts: 5
Default 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



  #4  
Old April 28th 09, 06:50 PM posted to microsoft.public.outlook.program_vba
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default 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


  #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



  #6  
Old April 28th 09, 11:36 PM posted to microsoft.public.outlook.program_vba
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default 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


  #7  
Old April 29th 09, 07:44 PM posted to microsoft.public.outlook.program_vba
Christopher Slowik
external usenet poster
 
Posts: 5
Default 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



  #8  
Old April 29th 09, 11:10 PM posted to microsoft.public.outlook.program_vba
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default 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


  #9  
Old April 29th 09, 11:31 PM posted to microsoft.public.outlook.program_vba
Christopher Slowik
external usenet poster
 
Posts: 5
Default 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



  #10  
Old April 30th 09, 03:58 PM posted to microsoft.public.outlook.program_vba
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default 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


 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Displaying contents of a Custom Form Kevin Smith Outlook - Using Forms 3 April 7th 08 04:01 PM
Custom form code not firing karlman[_2_] Outlook - Using Forms 10 January 4th 08 11:38 AM
Custom form code not firing karlman[_2_] Outlook and VBA 1 January 2nd 08 09:53 PM
Button to custom form Uncle Vito Outlook - Using Forms 3 March 3rd 07 02:06 PM
Add Button To Form That Automatically Saves Contents To Text File Dani Outlook - Using Forms 1 September 19th 06 01:17 PM


All times are GMT +1. The time now is 04:55 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.