
August 4th 06, 01:52 PM
posted to microsoft.public.outlook.program_vba
|
|
Shorcut button for Message Options
Eric wrote:
The first two things are relatively simple. You need two macros:
Sub DoNotSaveReply()
'Clears the 'Save sent messages to' option in the Message Options dialog
Dim objMessage As Object
Set objMessage = Application.ActiveInspector
objMessage.CurrentItem.DeleteAfterSubmit = True
Set objMessage = Nothing
End Sub
Sub RequestReadReceipt()
'Clears the 'Save sent messages to' option in the Message Options dialog
Dim objMessage As Object
Set objMessage = Application.ActiveInspector
objMessage.CurrentItem.ReadReceiptRequested = True
Set objMessage = Nothing
End Sub
Having sent items saved to a specific folder is a little tricker.
Public Sub SaveReplyToSpecificFolder()
On Error Resume Next
Dim objMessage As Outlook.MailItem
Dim objFolder As Outlook.MAPIFolder, objNS As Outlook.NameSpace
Dim SentItemsFolderID As String
Dim SentItemsFolderStoreID As String
SentItemsFolderID = "00000000796361434A311F408F1D9BA8D935F32802810 000"
SentItemsFolderStoreID =
"0000000038A1BB1005E5101AA1BB08002B2A56C2000070737 47072782E646C6C00000000000000004E495441F9BFB80100A A0037D96E000000433A5C446F63756D656E747320616E64205 3657474696E67735C657269636C5C4C6F63616C20536574746 96E67735C4170706C69636174696F6E20446174615C4D69637 26F736F66745C4F75746C6F6F6B5C657269636C6D61696C2E6 D7670732E6F72672D30303030303031302E70737400"
If Application.ActiveInspector.CurrentItem.Class
Outlook.OlObjectClass.olmail Then Exit Sub
Set objNS = Application.GetNamespace("MAPI")
Set objFolder = objNS.GetFolderFromID(SentItemsFolderID,
SentItemsFolderStoreID)
If objFolder Is Nothing Then
MsgBox "Unable to set Sent Message folder."
Exit Sub
End If
Set objMessage = Application.ActiveInspector.CurrentItem
Set objMessage.SaveSentMessageFolder = objFolder
Set objNS = Nothing
Set objMessage = Nothing
Set objFolder = Nothing
End Sub
You can use Outlook Spy (http://www.dimastry.com) to easily get the EntryID
and FolderID values for a specific folder, or use code (navigate to the
folder, use ActiveExplorer.CurrentFolder, etc.). Otherwise, navigate the
NameSpace.Folders collection to retrieve a specific MAPIFolder object.
To map custom toolbar buttons to a macro, choose Macros from the Categories
list in the Commands tab of the toolbar customization dialog, and select the
macro on the right.
--
Eric Legault (Outlook MVP, MCDBA, MCTS: Messaging & Collaboration)
Try Picture Attachments Wizard for Outlook:
http://www.collaborativeinnovations.ca
Blog: http://blogs.officezealot.com/legault/
" wrote:
Hi,
I'd like to be able to add two shortcut buttons to the toolbar on a new
mail message. Instead of clicking on Options Request a read receipt
OR
Options Save sent items...etc
I'd like to be able to have a button right on the standard toolbar for
each of these two options. It may only save a couple clicks but every
click helps!
Can I do this with VBA since there doesn't appear to be an option in
the available shortcut buttons in "customize"?
It would also be nice to customize where the sent message will be saved
to rather than the default "sent items" folder.
Thanks.
|