Select signature programatically

  • Thread starter Thread starter Wicked Wizard
  • Start date Start date
W

Wicked Wizard

Can anyone tell me please if it is possible have a macro to either cycle
through signatures, using them in turn as each new email is created, or even
better, to select a signature from the set at random?

If it is possible some hints as to how to do it would be gratefully
received.
 
Here's a procedure you can call that will insert the specified signature.
Alternately, you can modify it to cycle through the objSignatureMenu.Controls
collection to randomly pick one instead.

Sub InsertSpecificSignature(SignatureName As String)
On Error Resume Next

Dim objSignatureMenu As Office.CommandBarPopup
Dim objSigButton As Office.CommandBarButton
Dim objInsp As Outlook.Inspector, objItem As Object

If SignatureName = "" Then Exit Sub

Set objInsp = ActiveInspector

If objInsp Is Nothing Then Exit Sub

Set objSignatureMenu = objInsp.CommandBars.FindControl(, 31145)

If objSignatureMenu Is Nothing Then Exit Sub

Set objSigButton = objSignatureMenu.Controls.Item(SignatureName)

If objSigButton Is Nothing Then Exit Sub

Set objItem = objInsp.CurrentItem

objItem.Body = ""
objSigButton.Execute
End Sub
 
Back
Top