Macro for a stationery

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I want to program a macro that creates a new mail message using a stationery that I have created, to replace the menuwork: Actions - New Mail Message Using - a specific stationery

Suggestions?
 
What you can do is to set a reference to the "New Mail Message Using" menu
item (which is a CommandBarPopUp control), and loop through its Controls
collection to find any menu items that refer to a specific stationery. Note
that 32768 is the ID that "dynamic" buttons/menu items use, like the ones
under the menus for "New Mail Message Using", "Send/ Receive", etc. - any
menu set that can have X number of entries based on user configuration
settings. So you have to look for buttons that have that ID, but also check
the caption to verify that it is the one that you want.

Dim objButton As Object, objPopUp As Office.CommandBarPopup
Dim objControls As Office.CommandBarControls

Set objPopUp = ActiveExplorer.CommandBars.FindControl(, 31146)
Set objControls = objPopUp.Controls
For Each objButton In objControls
If objButton.Type = MsoControlType.msoControlButton Then
If objButton.ID = 32768 Then
'This is a stationery menu item
If objButton.Caption = "Citrus Punch" Then
'This is the stationery we want, in case more than one
is listed
objButton.Execute
End If
End If
End If
Next

--
Eric Legault - B.A, MCP, MCSD, Outlook MVP
--------------------------------------------------
Job: http://www.imaginets.com
Blog: http://blogs.officezealot.com/legault/


Matt said:
I want to program a macro that creates a new mail message using a
stationery that I have created, to replace the menuwork: Actions - New Mail
Message Using - a specific stationery.
 
Back
Top