Tuesday, December 11, 2012 2:20 PM
Outlook does not support changing the signature of existing (unsent) mail items by simple code like MailItem.SetSignature("mysigtemplate") or sth like that..
Up to Outlook 2010 you can use a trick by executing the signatures list item in the "message" ribbon or context menu (using Inspector.CommandBars.ActiveMenuBar.FindControl(...)). A code sample is shown at this link: Change signature using a macro.
For Outlook 2013 the Commandbars object is not longer supported (see article Compatibility issues in Outlook 2013 ), so the solution above cannot be used for resetting/changing the signature.
MS recommend to substitute Commandbar functions by using the IRibbonExtensibility interface but this supports only controls with static IdMso. Runtime defined Controls (like signature list control) cannot be accessed/executed.
Does anybody know if there is another way to do the job by code?
Wednesday, December 12, 2012 1:05 PMModerator
Thank you for posting in the MSDN Forum.
The page Change signature using a macro is not accessible to non subscription user. It will be nice if you can post it here.
I'll do some research over this issue, and will reply back if there's any discovery.
Thank you for your patient.
Quist Zhang [MSFT]
MSDN Community Support | Feedback to us
Develop and promote your apps in Windows Store
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Wednesday, December 12, 2012 1:29 PM
Please see the code example below.
Dim colCBControls As Office.CommandBarControls Dim objCBP, objCBP2 As Office.CommandBarPopup Dim objCBB As Office.CommandBarButton 'Find "Insert" menu popop Set objCBP = ActiveInspector.CommandBars.ActiveMenuBar.FindControl(, 30005) 'Find "Signatures" list popup Set objCBP2 = objCBP.CommandBar.FindControl(, 5608) If Not objCBP2 Is Nothing Then 'Find "mysigtemplate" item Set colCBControls = objCBP2.Controls For Each objCBB In colCBControls If objCBB.Caption = "mysigtemplate" Then objCBB.Execute Exit For End If Next End If
Tuesday, December 18, 2012 9:36 AM
have you found out anything helpful?
Tuesday, December 18, 2012 4:52 PMModerator