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.
Similar threads
Thread starter Title Forum Replies Date
Diane Poremsky Use Word Macro to Apply Formatting to Email Using Outlook 0
A Apply Selected Emails to outlook rules and Run Rules Using Outlook 5
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 Using Outlook 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 Using Outlook 2
F Apply Follow up flag ONLY to the people cc'd. Using Outlook 1
L Unable to apply SP1 to Exchange 2010 Exchange Server Administration 5
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
T Macro to move reply and original message to folder Outlook VBA and Custom Forms 6
D Autosort macro for items in a view Outlook VBA and Custom Forms 2
S HTML to Plain Text Macro - Help Outlook VBA and Custom Forms 1
A Macro to file emails into subfolder based on subject line Outlook VBA and Custom Forms 1
N Help creating a VBA macro with conditional formatting to change the font color of all external emails to red Outlook VBA and Custom Forms 5
S Visual indicator of a certain property or to show a macro toggle Outlook VBA and Custom Forms 2
L Modifying VBA script to delay running macro Outlook VBA and Custom Forms 3
S Macro to extract and modify links from emails Outlook VBA and Custom Forms 3
M Replyall macro with template and auto insert receptens Outlook VBA and Custom Forms 1
L Macro to add Date & Time etc to "drag to save" e-mails Outlook VBA and Custom Forms 8
S Macro for Loop through outlook unread emails Outlook VBA and Custom Forms 2
Globalforester ItemAdd Macro - multiple emails Outlook VBA and Custom Forms 3
S Macro to extract email addresses of recipients in current drafted email and put into clipboard Outlook VBA and Custom Forms 2
witzker HowTo start a macro with an Button in OL contact form Outlook VBA and Custom Forms 12
witzker Macro to move @domain.xx of a Spammail to Blacklist in Outlook 2019 Outlook VBA and Custom Forms 7
S Macro for other actions - Outlook 2007 Outlook VBA and Custom Forms 23
C Macro to extract sender name & subject line of incoming emails to single txt file Outlook VBA and Custom Forms 3
L Macro/VBA to Reply All, with the original attachments Outlook VBA and Custom Forms 3
S Macro to move “Re:” & “FWD:” email recieved the shared inbox to a subfolder in outlook Outlook VBA and Custom Forms 0
S Outlook Macro to send auto acknowledge mail only to new mails received to a specific shared inbox Outlook VBA and Custom Forms 0
S Outlook Macro to move reply mail based on the key word in the subjectline Outlook VBA and Custom Forms 0
Eike Move mails via macro triggered by the click of a button? Outlook VBA and Custom Forms 0
S Macro or plug-in to see if specific person was included in this email Outlook VBA and Custom Forms 4
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 Using Outlook 4
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

Similar threads

Top