Outlook 2007 inserts 2 lines before Signature


B

Bill P

I have multiple signatures setup in Outlook that I use as means of making a
quick reply. For example, if someone sends me a message but neglects to tell
me where they're from I have some boilerplate text asking them to tell me
where they're from. I just click Reply, add the appropriate Signature and
send the mail.

In Outlook 2003 this was a one click process for me. In Outlook 2007 the
Signature button automatically adds 2 blank lines before the Signature
itself. I can see where this might help some people, but it makes it
necessary for me to then click into the message and delete those 2 lines
before sending. It's a few extra keystrokes I don't need.

Is there any way to eliminate these 2 lines added before the Signature?
 
Ad

Advertisements

D

Diane Poremsky [MVP]

No, you can't remove them. Rather than signatures, use Quick Parts. They are
much better suited for this usage.

--
Diane Poremsky [MVP - Outlook]





EMO - a weekly newsletter about Outlook and Exchange:
(e-mail address removed)

You can access this newsgroup by visiting
http://www.microsoft.com/office/community/en-us/default.mspx or point your
newsreader to msnews.microsoft.com.
 
B

Bill P

Diane,

Thanks you very much. I was totally unaware of Quick Parts. That's a much
better way to handle messages like this. I found a good article about using
Quick Parts on LifeHacker
http://lifehacker.com/5031083/save-time-and-typing-with-outlook-2007s-quick-parts


Diane Poremsky said:
No, you can't remove them. Rather than signatures, use Quick Parts. They are
much better suited for this usage.

--
Diane Poremsky [MVP - Outlook]





EMO - a weekly newsletter about Outlook and Exchange:
(e-mail address removed)

You can access this newsgroup by visiting
http://www.microsoft.com/office/community/en-us/default.mspx or point your
newsreader to msnews.microsoft.com.


Bill P said:
I have multiple signatures setup in Outlook that I use as means of making
a
quick reply. For example, if someone sends me a message but neglects to
tell
me where they're from I have some boilerplate text asking them to tell me
where they're from. I just click Reply, add the appropriate Signature and
send the mail.

In Outlook 2003 this was a one click process for me. In Outlook 2007 the
Signature button automatically adds 2 blank lines before the Signature
itself. I can see where this might help some people, but it makes it
necessary for me to then click into the message and delete those 2 lines
before sending. It's a few extra keystrokes I don't need.

Is there any way to eliminate these 2 lines added before the Signature?
 
Joined
Sep 18, 2011
Messages
6
Reaction score
0
For info:

I was trying to get a resolution for the issue myself for Outlook (Win 7, Office 2010 & I also had it in XP Professional Office 2003) but after a lot of searching I could not, so not one to give up I modified some code to do the job via VBA in Outlook so that every time you open a New Email Message with a Signature (where Outlook automatically adds in an extra 2 lines) it implicitly deletes those lines. I have added the solution below.

Assumptions: you will recode the routine to actually determine new email messages rather than just olMail class but the error trap in the open handler will suffice for a quick fix, I hope this helps someone! Mark Kubiszyn.

Put this in the ThisOutlookSession Module:

Code:
Option Explicit

' clsInspector class will remove additional 2 lines from outlook signatures
Dim Insp As clsInspector

Private Sub Application_Quit(): Set Insp = Nothing: End Sub
Private Sub Application_Startup(): Set Insp = New clsInspector: End Sub
...and put this into a new class Module entitled clsInspector:

Code:
Option Explicit

Dim WithEvents oAppInspectors   As Outlook.Inspectors
Dim WithEvents oMailInspector   As Outlook.Inspector
Dim WithEvents oOpenMail        As Outlook.MailItem

Private Sub Class_Initialize()
 Set oAppInspectors = Application.Inspectors
End Sub

Private Sub oAppInspectors_NewInspector(ByVal Inspector As Inspector)
 If Inspector.CurrentItem.Class <> olMail Then
  Exit Sub
 End If
  Set oOpenMail = Inspector.CurrentItem
  Set oMailInspector = Inspector
End Sub

Private Sub oOpenMail_Open(Cancel As Boolean)
On Error GoTo e
 Const wdStory = 6
 Dim objDoc, objSel
 Set objDoc = oMailInspector.WordEditor
 Set objSel = objDoc.Windows(1).Selection
 objSel.Move wdStory, -1 ' start of editor/signature
 objSel.Delete ' line 1
 objSel.Delete ' line 2
e:
 Exit Sub
End Sub

Private Sub oOpenMail_Close(Cancel As Boolean)
 Set oOpenMail = Nothing
 Set oMailInspector = Nothing
End Sub

Private Sub Class_Terminate()
 Set oAppInspectors = Nothing
 Set oOpenMail = Nothing
End Sub
 
Joined
Oct 8, 2011
Messages
3
Reaction score
0
Hello Paradigm,

I've been looking for a resolution to delete the first two lines for a long time, but I don't know where to put in " Put this in the ThisOutlookSession Module:"

Would you please try to explaine it to me?

It should work in WinXP and Win7 with Outlook 2003 and 2007.

Best regards
beruno
 
Joined
Sep 18, 2011
Messages
6
Reaction score
0
beruno:

I use this code successfully at home with Win 7 & Office 2010 (Outlook Version 14) and at work with XP Professional & Office 2003 (Outlook Version 11) .

You need to open Outlook and press Alt+F11 to enter the VBA Project (should show VbaProject.OTM at the top).

On the left in the Project Explorer double-click the Microsoft Outlook Objects Folder in the Tree and then double-click ThisOutlookSession. Enter the following Code:

Code:
Option Explicit

' add to ThisOutlookSession
' the clsInspector class will remove additional 2 lines from outlook signatures
Dim Insp As clsInspector

Private Sub Application_Quit(): Set Insp = Nothing: End Sub
Private Sub Application_Startup(): Set Insp = New clsInspector: End Sub
OK, now on the File Menu do View->Insert Class Module. Select the Class1 default and in the Project Properties Window rename it to clsInspector.

Double-click the renamed Class Module clsInspector. Enter the following Code:

Code:
Option Explicit

Dim WithEvents oAppInspectors   As Outlook.Inspectors
Dim WithEvents oMailInspector   As Outlook.Inspector
Dim WithEvents oOpenMail        As Outlook.MailItem

Private Sub Class_Initialize()
 Set oAppInspectors = Application.Inspectors
End Sub

Private Sub oAppInspectors_NewInspector(ByVal Inspector As Inspector)
 If Inspector.CurrentItem.Class <> olMail Then
  Exit Sub
 End If
  Set oOpenMail = Inspector.CurrentItem
  Set oMailInspector = Inspector
End Sub

Private Sub oOpenMail_Open(Cancel As Boolean)
On Error GoTo e
 Const wdStory = 6
 Dim objDoc, objSel
 Set objDoc = oMailInspector.WordEditor
 Set objSel = objDoc.Windows(1).Selection
 objSel.Move wdStory, -1 ' start of editor/signature
 objSel.Delete ' line 1
 objSel.Delete ' line 2
e:
 Exit Sub
End Sub

Private Sub oOpenMail_Close(Cancel As Boolean)
 Set oOpenMail = Nothing
 Set oMailInspector = Nothing
End Sub

Private Sub Class_Terminate()
 Set oAppInspectors = Nothing
 Set oOpenMail = Nothing
End Sub
Ok, now either press Save in the VBA Project Editor or close the VBA Project Editor and close Outlook. If you do the latter Outlook should prompt for:

Do you want to save the VBA project 'VbaProject.OTM'? whereby pressing yes should save your code. Reopen Outlook.

I think the first time I did this with Outlook at home in Office 2010 it saved nothing which was a little strange, but worked the second time; worked fine at work Outlook in Office 2003.

Oh' and you need to have enabled Macros. I always allow Outlook to prompt me to Use Macros both at home and at work.

There you have it, create a new Signature and the first 2 lines should vanish when you open a New Mail Message Item only! P. Hope you get it working as this issue got me so mad I had to find a solution! :D
 
Ad

Advertisements

Joined
Oct 8, 2011
Messages
3
Reaction score
0
Hallo Paradigm,

thanks a lot for your reply.

I dit as you described, with the result, the 2 lines are still there and I am unable to write in my signature. :cry:

I'd like to try it once from the beginning, but where can I delete this macro?

Could it be it doesn't work because I wrote my signature by hand in htm and not with word?

Best regards
beruno
 
Joined
Sep 18, 2011
Messages
6
Reaction score
0
Yes the Code can only be used if Word is your default Editor, apologies if I did not mention that one! My Signatures were created by opening and entering or pasting into Word.

I use many HTML Templates that I have created and have never actually had the extra line issue with them? I would urge you to try some of these for formatting that works in (I think) all Outlook Versions - I love these Templates:
https://github.com/mailchimp/Email-Blueprints
Press the Downloads Button on the Right Hand Side.

ANyhow, to sum up, my problem was only with Signatures created using Word whereby Outlook was adding extra lines at the beginning of a New Message, which the Code above should solve.

If you need to remove the Code within Outlook, simply right-click on a Code Module and Remove it. In the ThisOutlookSession, just delete anything in the Module. Then either press Save in the VBA Editor or just close it and then close Outlook - you should get a Prompt to save the blank Project.

Other Info:
You can also find the VbaProject.OTM in the following Folder:
Drive:\Windows\Application Data\Microsoft\Outlook

Users
%appdata%\Microsoft\Outlook
 
Joined
Sep 18, 2011
Messages
6
Reaction score
0
Hi beruno

Well that's a start!

I wasn't blaming your HTML Coding by the way by directing you to the mailchimp templates - it's just sometimes difficult ascertaining what another persons Exact problem is. I must admit that before I started using their templates I used to have conflicting issues between Outlook clients i.e. highlighting colours for links, wrapping in html tables & some strange goings on! Their templates solved this and I use them at work & at home with great success.

Anyhow, you are right, never give in & Post back if you manage to resolve it, best of luck. P.
 
Joined
Nov 8, 2012
Messages
1
Reaction score
0
Hi Paradigm,

Excellent Work. It worked for me and feels great getting rid of those two lines. Initially it didn't work as I had disabled macros. But after enabling Macros, it worked like charm. Just bit worried about macros as the warning says that malicious code can run. :(. Don't know why Stupid MS thinks that those two lines are required. If some one really wants two lines they can always add so in their signature so MS shouldn't have added those two lines in first place.

I registered on this site just to say thanks to you.

Thanks and keep it up.
KR
 
Ad

Advertisements

Joined
Sep 18, 2011
Messages
6
Reaction score
0
trident123

No problem - I am glad that it worked for you. I still use the Code at Home and at Work with XP Professional (Office 2003) & now Win7 (Office 2010). I looked everywhere for a fix without any luck. I still can't believe other people ignore the 2 line thing!

Thank you for replying & your input, Mark.
 
Joined
Sep 18, 2011
Messages
6
Reaction score
0
Update:

I have recently been looking at the whole 2 line Signature thing again with a colleague because of some other Font related issues she was having. She queried my reasoning behind wanting to remove the 2 lines in a new Email at all due to the fact that my fix and writing directly into a Signature failed to pick up her spelling mistakes. After much debate, I would like to add the following observations to anyone looking at this issue:

i. Using my fix means that anything you enter in the new mail is taken as being a part of the Signature ergo, typing an incorrect Spelling will ''not'' be identified by the Outlook Spell checker so you cannot use the Spell checker at all.

ii. My logic behind using this fix was driven by Third Party Software email-template (Outlook) Software that I was writing at the time which made sense. However I now have had to ask myself ''why'' do I need to remove the lines in normal use today especially as I now require the Spell checker?

So, in Summary If you do not need to explicitly remove the 2 extra lines I recommend that you do the following to set-up your Email correctly in Outlook 2010:

- adjust the Font for a new Email/Reply Email using File->Options->Mail->Stationery & Fonts
- create a new Signature as normal and paste in into File->Options->Mail->Signatures->New E-mail Signature

Then when you create a New Email you will have your Signatures that can be changed using right-click and you have the 2 lines as a default using your pre-set Outlook Font to begin your new Message/Reply.

Cheers, Mark Kubiszyn
 
Ad

Advertisements

Joined
Jul 17, 2014
Messages
1
Reaction score
0
Hello! I am new to the forums and I wanted to post my VBA solution for removing one of double carriage returns inserted before HTML signatures.

This solution is intended for users who are creating new emails using VBA, but I'm sure the idea can be stretched to other uses.

I use Outlook 2010. I figured out this solution by creating a new email with the default signature and sending that to myself so I could view the HTML source code.
I noticed two identical <p> paragraph tags appearing before my acutal signature and I figured that was what was causing the carriage returns.

The HTML tags were
HTML:
<p class=MsoNormal><o:p>&nbsp;</o:p></p>
So I simply did a Find & Replace in VBA to look for a double instance of this (i.e.,
HTML:
<p class=MsoNormal><o:p>&nbsp;</o:p></p><p class=MsoNormal><o:p>&nbsp;</o:p></p>
) and I just deleted the duplicate. In other words, I found the double instance and replaced the double instance with a single instance.

I am not sure if your HTML code will be exactly the same but it doesn't hurt to check. Just open up a sent/recieved email with your signature (NOT A DRAFT) and right click the body and select View Source.

If you find the exact <p> tag I listed above, you can use a variation of my code to solve the problem. Otherwise, send yourself an email with just the default signature (including line returns) and look carefully where the carriage return tags are (usually going to be a <p></p><p></p> tag or maybe even a <br></br><br></br> tag)

Here is a snippet of my code:

Code:
    '----------------------------------'
    ' CREATE A NEW PRE-POPULATED EMAIL '
    '----------------------------------'
    Dim newMsg As MailItem, sig As String
    Set newMsg = Application.CreateItem(olMailItem)

    With newMsg
        .To = recip			'recip is a string of the "To" addressess
        .Subject = subj			'subj is a string of the Subject Line
        .BodyFormat = olFormatHTML
        .Display			'I display the email first so the signature auto populates
        sig = .HTMLBody			'I save the HTML body into the string variable "sig"
        
	'HERE I REPLACE THE DOUBLE INSTANCE OF THE <p> TAGS WITH JUST A SINGLE INSTANCE

	sig = Replace(sig, _
            "<p class=MsoNormal><o:p>&nbsp;</o:p></p><p class=MsoNormal><o:p>&nbsp;</o:p></p>", _
            "<p class=MsoNormal><o:p>&nbsp;</o:p></p>")

        .Body = msg			'msg is a string of the message I actually want to write in the body

	'Then I take the HTML version of the Body (which now contains the "msg" body I want)
	'and I attach the signature to it using the "sig" variable which contains the HTML signature
	'with just one carriage return before the actual signature

        .HTMLBody = .HTMLBody & vbCrLf & "Best Regards," & sig
        .ReadReceiptRequested = True
    End With
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top