Remove extra line above signature in reply

Status
Not open for further replies.

Jaroslav

New Member
Outlook version
Outlook 2010 64 bit
Email Account
Exchange Server
Hello,
I put together simple code to reply to selected email. It takes some predefined text and adds HTMLbody of the reply item. The problem is, when creating reply message, outlook puts two blank lines above signature by default. Normally, this doesn´t matter as I start writing on the first line, while the second line serves as separator between text and signature. When replying with VBA, however, both blank lines remain between the text and signature. Maybe I am being petty, but is there a way to keep just one of these lines? I searched the internets back and forth to no avail, so any help would be appreciated greatly.
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
well, it looks like its not going away here - i swear it did before.

using insertbefore method from Add Attachment Names to Message Before Sending - it doesn't add an extra line.

This is my sample test code using that method.

Code:
Sub CreateReply()
Dim Item As MailItem
Dim oForward  As MailItem

    Dim olInspector As Outlook.Inspector
    Dim olDocument As Word.Document
    Dim olSelection As Word.Selection
     
Set Item = Application.ActiveExplorer.Selection.Item(1)
Set oForward = Item.Forward
oForward.Display
      
    Set olInspector = Application.ActiveInspector()
    Set olDocument = olInspector.WordEditor
    Set olSelection = olDocument.Application.Selection

olSelection.HomeKey Unit:=wdStory
olSelection.InsertBefore "the text "
End Sub
 

Jaroslav

New Member
Outlook version
Outlook 2010 64 bit
Email Account
Exchange Server
Insertbefore works great. I just changed Item.Forward to Item.Reply and had to use vblf instead if HTML tags for line breaks. Thank you very much Diane
 

anacl

New Member
Outlook version
Outlook 2016 64 bit
Email Account
Office 365 Exchange
Hello! I know this forum is from sometime ago but it's the closest thing I have found to my problem. I have this macro in excel VBA to generate email by batches from information in excel. The only problem I have is the extra line between the last sentence and the signature, any idea how can I delete it?

Option Explicit
Sub Example()
Dim olApp As Object
Dim olMail As Object
Dim olRecip As Object
Dim olAtmt As Object
Dim iRow As Long
Dim Recip As String
Dim Subject As String
Dim Atmt As String


iRow = 2

Set olApp = CreateObject("Outlook.Application")

Do Until IsEmpty(Cells(iRow, 1))

Recip = Cells(iRow, 1).Value
Subject = Cells(iRow, 3).Value
Atmt = Cells(iRow, 4).Value ' Attachment Path


Set olMail = olApp.CreateItem(0)

With olMail
Set olRecip = .Recipients.Add(Recip)
.Display
.Subject = Subject
.HTMLbody = "<html><body><p>Dear " & Cells(iRow, 2).Value & "," & "<br>" & "<br>" & "message 1" & "<br>" & "<br>" & "message 1" & "<br>" & "<br>" & "Congratulations!" & .HTMLbody
Set olAtmt = .Attachments.Add(Atmt)
olRecip.Resolve
.Save
.Close 1


End With

iRow = iRow + 1

Loop

Set olApp = Nothing
Exit Sub

End Sub

I looks like this:

Dear Mr. Example 2,

message 1

message 1

Congratulations!


Signature

Thank you in advance!
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
It's probably because the body has an extra line above it in the body. Actually, by the looks of it, there are two lines...
sig-ex.png


is there anything in the message body besides the signature and what you add via code?
.HTMLbody = "<html><body><p>Dear " & Cells(iRow, 2).Value & "," & "<br>" & "<br>" & "message 1" & "<br>" & "<br>" & "message 1" & "<br>" & "<br>" & "Congratulations!" & .HTMLbody

It could also be due to the code you are using, but i dont think so - you dont need <html><body> and don't have a closing p after congrats. "Congratulations! </p>" &

if the signature is the only thing picked up by & .htmlbody, you can use file system objects to insert the signature.
Insert or change an Outlook signature using VBA - use the dim strBuffer to the signature close line code in your code above (you can put it before setting outlook object) then change the html body line to .HTMLBody = "<p>Something here.</p><p> </p>" & strBuffer - remove the extra paragraph if needed.
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
D How to remove "extra" contacts folders in Outlook 2010 Using Outlook 4
T Outlook 2016 remove envelope icon for certain folders Using Outlook 5
M In Outlook Calendar remove the buttons: 'Today' and '<' (Back a day) and '>' (Forward a day) that are below the Ribbon and above the calendar display. Using Outlook 0
P [SOLVED] Auto remove [EXTERNAL] from subject Using Outlook 14
P Add, remove, & reorder folder pane Using Outlook 6
W Remove specific contacts from contact list Outlook VBA and Custom Forms 3
T Cannot remove needless PST Using Outlook 1
Healy Consultants Macro to remove inside organization distribution list email address when reply to all recepients Outlook VBA and Custom Forms 0
S Unable to remove rule outlook 2010 Using Outlook 0
N How to remove signature formatting from Text in Word (accidentally taken from Outlook) Using Outlook 0
B Remove Subject Residual Outlook VBA and Custom Forms 3
P how to remove unwanted PST file default categories assigned to many calendar entries Using Outlook 7
J Remove text to Clean Up Outlook VBA and Custom Forms 1
B Automatically Forward Emails and Remove/Replace All or Part of Body Outlook VBA and Custom Forms 8
D Remove text in subject using VBA Outlook VBA and Custom Forms 4
T Remove Old Location From Tasks Pane Using Outlook 1
A remove or turn off outlook.com contact folder from outlook 2016 Using Outlook 4
R Chancing / remove “ something ” in the subject, online archive Outlook VBA and Custom Forms 8
Morgan Fowler Remove Signature Using Outlook 1
M How to remove a list of specific contacts from Outlook Using Outlook 18
R New Links on Navigation Pane, How to Remove? Using Outlook 1
M VBA to remove deferred delivery on a MeetingItem Outlook VBA and Custom Forms 2
Diane Poremsky How to Remove RSS Support from Outlook New Slipstick.com Articles 0
Diane Poremsky Remove Attachments From Messages New Slipstick.com Articles 0
Diane Poremsky Remove Office 2013 Update Banner New Slipstick.com Articles 0
O Remove duplicate mail items Outlook VBA and Custom Forms 6
Diane Poremsky Remove a password from an Outlook *.pst File New Slipstick.com Articles 3
G VBA/Macro to remove page colour when replying or forwarding email Outlook VBA and Custom Forms 2
L Fake reminder apperaring (not in calendar) - how to remove? Using Outlook 5
J Your IMAP server wants to alert you to the following: cannot remove system folder Using Outlook 3
A Auto Insert of filename when selecting 'Remove Attachment' Using Outlook 1
C how to remove icons on right hand side outlook 2013 Using Outlook 2
K Remove Manage APPS button for users Exchange Server Administration 1
P Remove name and parenthses from email Using Outlook 1
G Outlook calendar entry corrupted. Constant pop up when you open outlook. Unable to delete or remove. Using Outlook 2
Diane Poremsky How to remove the primary account from Outlook 2010/2013 New Slipstick.com Articles 0
Diane Poremsky Remove an Address from Reply All New Slipstick.com Articles 0
Diane Poremsky Remove Outlook apps from Outlook New Slipstick.com Articles 0
L An () has been inserted after the address in an address box; how do I remove them. Using Outlook 1
S How to remove forms from Organizational forms library Outlook VBA and Custom Forms 2
2 Task has a strike through but is not complete - how to remove? Using Outlook 1
A Is it possible to remove the word Categories: from task list views? Using Outlook 2
W URGENT Cancel and remove imported pop3 mails Using Outlook 6
Emerogork How do I remove "Delete Folder" from the right-click menu? Using Outlook 1
T How to remove annoying Big Blue Type at beginning of my messages Using Outlook 2
H Cannot remove unwanted fields from form Outlook VBA and Custom Forms 9
T How to remove "automatically delete messages form this sender"? Using Outlook 1
M How to remove duplicate history items BCM (Business Contact Manager) 7
D Isn't there an easy way to remove duplicate contacts in outlook? Using Outlook 1
Britonius Exchange Powershell to Remove Reviewer access from all Folders in a mailbox? Using Outlook 3

Similar threads

Top