Is there a way to apply a macro before a signature is applied in email?

Status
Not open for further replies.

tech_droid

Member
Outlook version
Outlook 2007
Email Account
Exchange Server
When it comes to VBA scripting and macro's, I avoid it like the plague. However I have a situation where an end user wants to always reply to people in HTML format. Regardless if it comes in as plain text or not. In any case, I was able to find the macro listed below that pretty much takes care of the users needs.

However... The additional problem that needs to be solved is that his signature which is HTML formatted is being inserted into the reply before the HTML formatting takes affect by the macro. So essentially the formatting gets wiped because it's being inserted into the email when it's still plain text and then gets the HTML macro hitting after the insert.

Is there a way to cause the macro to take affect before the signature is applied?

~~~~ Macro Being Used Below ~~~~

Option Explicit

Private WithEvents oExpl As Explorer

Private WithEvents oItem As MailItem

Private bDiscardEvents As Boolean

Private olFormat As OlBodyFormat

Private Sub Application_Startup()

Set oExpl = Application.ActiveExplorer

bDiscardEvents = False

'olFormat = olFormatPlain '(*1) - uz.ywaj zawsze formatu "zwyk?y tekst"
olFormat = olFormatHTML '(*2) - uz.ywaj zawsze formatu HTML


End Sub

Private Sub oExpl_SelectionChange()
On Error Resume Next
Set oItem = oExpl.Selection.Item(1)


End Sub

' (*3) Uz.ytkownik wybra? polecenie "Odpowiedz"

Private Sub oItem_Reply(ByVal Response As Object, Cancel As Boolean)
If bDiscardEvents Or oItem.BodyFormat = olFormat Then
Exit Sub
End If

'(*4) Anuluj domys'lna; akcje;
Cancel = True
bDiscardEvents = True

' (*5) Utwo'rz odpowiedz' na wiadomos'c' w formacie tekstowym
Dim oResponse As MailItem
Set oResponse = oItem.Reply
oResponse.Display
oResponse.BodyFormat = olFormat

bDiscardEvents = False


End Sub

' (*6) Uz.ytkownik wybra? polecenie "Odpowiedz wszystkim"

Private Sub oItem_ReplyAll(ByVal Response As Object, Cancel As Boolean)
If bDiscardEvents Or oItem.BodyFormat = olFormat Then
Exit Sub
End If
Cancel = True
bDiscardEvents = True

Dim oResponse As MailItem
Set oResponse = oItem.ReplyAll
oResponse.Display
oResponse.BodyFormat = olFormat

bDiscardEvents = False


End Sub

' (*7) Uz.ytkownik wybra? polecenie "Przes'lij dalej"

Private Sub oItem_Forward(ByVal Forward As Object, Cancel As Boolean)

If bDiscardEvents Or oItem.BodyFormat = olFormat Then
Exit Sub
End If

Cancel = True
bDiscardEvents = True

Dim oResponse As MailItem
Set oResponse = oItem.Forward
oResponse.Display
oResponse.BodyFormat = olFormat

bDiscardEvents = False


End Sub
 
Status
Not open for further replies.
Thread starter Similar threads Forum Replies Date
Diane Poremsky Use Word Macro to Apply Formatting to Email New Slipstick.com Articles 0
J Automatically forward email and apply template Outlook VBA and Custom Forms 0
O How to apply view settings on all accounts and folders Using Outlook 7
E Apply customized Business Card for all users Outlook VBA and Custom Forms 0
G how can Apply User-defined Field to all Sub Folder and Other Using Outlook 14
Diane Poremsky Apply Outlook Stationery to Replies and Forwards New Slipstick.com Articles 0
A Can i apply mail rules to inbox sub folders using VBA Outlook VBA and Custom Forms 2
B Apply two rules on one email Using Outlook 2
R Rules - apply to messages > n days old Using Outlook 2
B Unable to apply rule on Exchange server functional account Exchange Server Administration 1
M Apply different views to calendars Using Outlook 0
C Apply Category Color for Appointment Background Color Calendar Printing Assistant 2
F Apply Follow up flag ONLY to the people cc'd. Using Outlook 1
K Why doesn't a rule apply to a friendly name? Using Outlook 2
L Unable to apply SP1 to Exchange 2010 Exchange Server Administration 5
R Apply New Rule Deletes Sent Items Using Outlook 1
L Can't apply ADM policies to Outlook 2007 and Outlook 2010 Using Outlook 7
L Can't apply ADM policies to Outlook 2007 and Outlook 2010 Using Outlook 1
T -basefolderonly still apply when creating a new retention policy in Exchange 2010/sp1? Exchange Server Administration 6
B How to apply filter when printing a view in contacts Using Outlook 3
T Outlook 2003 - View Filter apply by default on new mailbox folder Using Outlook 2
B Email Policy undewr Organization Configuration does not apply as it should Exchange Server Administration 6
O How to set view and apply to all? Using Outlook 2
H Create/Apply auto formatting rules by VB? Outlook VBA and Custom Forms 2
R Apply a category to item in inbox view Outlook VBA and Custom Forms 1
S Macro or plug-in to see if specific person was included in this email Outlook VBA and Custom Forms 3
U Macro for reminders,tasks,calendar Outlook VBA and Custom Forms 4
V macro runs slower on startup than after Outlook VBA and Custom Forms 3
N Macro to move all recipients to CC while replying Outlook VBA and Custom Forms 0
A VBA macro for 15 second loop in send and received just for 1 specific mailbox Outlook VBA and Custom Forms 1
G VBA Macro Calendar Printing Assistant 3
R Help Revising VBA macro to delete email over different time span Outlook VBA and Custom Forms 0
M Outlook macro to automate search and forward process Outlook VBA and Custom Forms 6
R Macro Schedule every day in Outlook Using Outlook 0
L Moving emails with similar subject and find the timings between the emails using outlook VBA macro Outlook VBA and Custom Forms 1
Healy Consultants Macro to remove inside organization distribution list email address when reply to all recepients Outlook VBA and Custom Forms 0
geofferyh Cannot get Macro to SAVE more than one message attachment??? Outlook VBA and Custom Forms 5
N How can I increase/faster outlook VBA Macro Speed ? Using Outlook 2
4 Macro to set the category of Deleted Item? Outlook VBA and Custom Forms 2
D.Moore Folder view settings by VBA macro Outlook VBA and Custom Forms 57
A Outlook macro to create search folder with mail categories as criteria Outlook VBA and Custom Forms 3
Dave A Run macro on existing appointment when it changes Outlook VBA and Custom Forms 1
V Outlook Macro to show Flagged messages Outlook VBA and Custom Forms 2
O Run macro automatically at sending an email Using Outlook 11
R Retain Original Message When Forwarding With Macro Outlook VBA and Custom Forms 3
C Macro to add multiple recipients to message Outlook VBA and Custom Forms 3
B Reply and replyall macro is not working Outlook VBA and Custom Forms 1
O Macro - paste as plain text Outlook VBA and Custom Forms 2
J Help Please!!! Outlook 2016 - VBA Macro for replying with attachment in meeting invite Outlook VBA and Custom Forms 9
witzker Macro to set contact reminder to next day 9:00 Outlook VBA and Custom Forms 45
Similar threads


















































Top