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
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
 
no, there is not a way to do the macro before the sig. What might work is to delete the signature before the conversion then add it back. Unfortunately, i don't have any code samples for this.
 
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
G Apply Custom Contacts form to all existing Contacts Outlook VBA and Custom Forms 1
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
X Custom icon (not from Office 365) for a macro in Outlook Outlook VBA and Custom Forms 1
X Run macro automatically when a mail appears in the sent folder Using Outlook 5
mrrobski68 Issue with Find messages in a conversation macro Outlook VBA and Custom Forms 1
G Creating Macro to scrape emails from calendar invite body Outlook VBA and Custom Forms 6
M Use Macro to change account settings Outlook VBA and Custom Forms 0
J Macro to Reply to Emails w/ Template Outlook VBA and Custom Forms 3
C Outlook - Macro to block senders domain - Macro Fix Outlook VBA and Custom Forms 1
Witzker Outlook 2019 Macro to seach in all contact Folders for marked Email Adress Outlook VBA and Custom Forms 1
S macro error 4605 Outlook VBA and Custom Forms 0
A Macro Mail Alert Using Outlook 4
J Outlook 365 Outlook Macro to Sort emails by column "Received" to view the latest email received Outlook VBA and Custom Forms 0
J Macro to send email as alias Outlook VBA and Custom Forms 0
M Outlook Macro to save as Email with a file name format : Date_Timestamp_Sender initial_Email subject Outlook VBA and Custom Forms 0
Witzker Outlook 2019 Macro GoTo user defined search folder Outlook VBA and Custom Forms 6
D Outlook 2016 Creating an outlook Macro to select and approve Outlook VBA and Custom Forms 0
Witzker Outlook 2019 Macro to send an Email Template from User Defined Contact Form Outlook VBA and Custom Forms 0
Witzker Outlook 2019 Macro to check Cursor & Focus position Outlook VBA and Custom Forms 8
V Macro to mark email with a Category Outlook VBA and Custom Forms 4
M Outlook 2019 Macro not working Outlook VBA and Custom Forms 0
S Outlook 365 Help me create a Macro to make some received emails into tasks? Outlook VBA and Custom Forms 1
Geldner Send / Receive a particular group via macro or single keypress Using Outlook 1
D Auto Remove [EXTERNAL] from subject - Issue with Macro Using Outlook 21
V Macro to count flagged messages? Using Outlook 2
sophievldn Looking for a macro that moves completed items from subfolders to other subfolder Outlook VBA and Custom Forms 7
S Outlook Macro for [Date][Subject] Using Outlook 1
E Outlook - Macro - send list of Tasks which are not finished Outlook VBA and Custom Forms 3
E Macro to block senders domain Outlook VBA and Custom Forms 1
D VBA Macro to Print and Save email to network location Outlook VBA and Custom Forms 1
N VBA Macro To Save Emails Outlook VBA and Custom Forms 1
N Line to move origEmail to subfolder within a reply macro Outlook VBA and Custom Forms 0
Witzker Outlook 2019 Macro to answer a mail with attachments Outlook VBA and Custom Forms 2
A Outlook 2016 Macro to Reply, ReplyAll, or Forward(but with composing new email) Outlook VBA and Custom Forms 0

Similar threads

Back
Top