Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Outlook / Programming Forms / March 2005

Tip: Looking for answers? Try searching our database.

launch 'Revise Contents' with vba

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Urs Ruefenacht - 01 Mar 2005 10:18 GMT
I fail to launch the 'Revise Contents' menu ("Edit | Revise Contents")
with the following code in the Item_Open Event:

Set objInspector = Item.GetInspector
Set objCommandBars = objInspector.CommandBars
Set objReviseContents = objCommandBars.FindControl(, 3273)

If Not objReviseContents Is Nothing Then
    objReviseContents.Execute
End If
Set objReviseContents = Nothing

The objReviseContents is still nothing.
Is 3273 the wrong id?

thx in advance - cheers
oers
Eric Legault [MVP - Outlook] - 01 Mar 2005 19:20 GMT
You can also try doing it this way:

   Dim objInspector As Outlook.Inspector
   Dim objCommandBars  As Office.CommandBars
   Dim objCommandBar As Office.CommandBar
   Dim objCBPU As Office.CommandBarPopup
   Dim objReviseContents As Office.CommandBarControl
   
   Set objInspector = Application.ActiveInspector
   Set objCommandBars = objInspector.CommandBars
   Set objCommandBar = objCommandBars.Item("Menu Bar")
   Set objCBPU = objCommandBar.Controls("Edit")
   Set objReviseContents = objCBPU.Controls("Revise Contents")
   Set objReviseContents =
objCommandBar.FindControl(MsoControlType.msoControlButton, 3273)
   
   If Not objReviseContents Is Nothing Then
       objReviseContents.Execute
   End If
   
   Set objCBPU = Nothing
   Set objInspector = Nothing
   Set objCommandBar = Nothing
   Set objCommandBars = Nothing
   Set objReviseContents = Nothing

Signature

Eric Legault - B.A, MCP, MCSD, Outlook MVP
--------------------------------------------------
{Private e-mails ignored}
Job: http://www.imaginets.com
Blog: http://blogs.officezealot.com/legault/

> I fail to launch the 'Revise Contents' menu ("Edit | Revise Contents")
> with the following code in the Item_Open Event:
[quoted text clipped - 13 lines]
> thx in advance - cheers
> oers
Urs Ruefenacht - 02 Mar 2005 12:46 GMT
With this code the object 'objReviseContents' will be created, but
objReviseContents.Execute has no effect in the Item_Open Event. If I
execute the same code in a button_Click event it works... what is the
difference?

Eric Legault [MVP - Outlook] schrieb:
> You can also try doing it this way:
>
[quoted text clipped - 21 lines]
>     Set objCommandBars = Nothing
>     Set objReviseContents = Nothing
Eric Legault [MVP - Outlook] - 02 Mar 2005 15:31 GMT
First, this is a redundant line of code that you should delete from my
previous post:

Set objReviseContents =
objCommandBar.FindControl(MsoControlType.msoControlButton, 3273)

I tried executing this button in the Item_Open and Inspector_Activate
events, and it looks like toolbar buttons cannot be executed programmatically
until after the form has completely loaded, which it won't be until after the
Item_Open/Inspector_Activate event.  Makes sense, and truthfully I've never
tried executing toolbars in this context before so this is good to know!

The only other option I can think of is to use a Timer control on a custom
form (or Win32 API timer events) that will execute and fire the Revise
Contents button a few seconds after the form loads.

--
Eric Legault - B.A, MCP, MCSD, Outlook MVP
--------------------------------------------------
{Private e-mails ignored}
Job: http://www.imaginets.com
Blog: http://blogs.officezealot.com/legault/

> With this code the object 'objReviseContents' will be created, but
> objReviseContents.Execute has no effect in the Item_Open Event. If I
[quoted text clipped - 27 lines]
> >     Set objCommandBars = Nothing
> >     Set objReviseContents = Nothing
Urs Ruefenacht - 04 Mar 2005 08:27 GMT
Thanks - good idea with the timer. I don't have tried it yet.

Is there possibility to enable 'Revise Contents' globally or for a
single (custom) form in the outlook options or registry? In Outlook 2000
I don't have to revise contents for editing a reopened form.

Eric Legault [MVP - Outlook] schrieb:
> First, this is a redundant line of code that you should delete from my
> previous post:
[quoted text clipped - 18 lines]
> Job: http://www.imaginets.com
> Blog: http://blogs.officezealot.com/legault/
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.