HTML to Plain Text Macro - Help

SamuelDawes

New Member
Outlook version
Outlook 2007
Email Account
Exchange Server
Good Morning,

I am using a macro that converts selected HTML emails into Plain Text, then prints them out. The macro works perfectly.

I was wondering how i would add some code that would format the selected HTML email to the 'No Spacing' style before converting it into Plain Text.
Condensing all the text from an email and removing all the guff, so it is in a format that prints efficiently.

Code:
Sub ConvertPlainText()

    Dim selItems            As Selection
    Dim myItem              As Object

    ' Set reference to the Selection.
    Set selItems = ActiveExplorer.Selection

    '  Loop through each item in the selection.
    For Each myItem In selItems
            myItem.BodyFormat = olFormatPlain
        'myItem.Save
        myItem.PrintOut
    Next
    
    Set selItems = Nothing

End Sub

I have tried multiple solutions and exhausted my google options.
Any help would be much appreciated!

Kind Regards,

Sam
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
You would need to use the word object model to do that. I don't know if it would be easier to search for 2 line breaks and remove 1, after it is converted.

something like
mybody = replace(myItem.Body,vbcrlf & vbcrlf,vbcrlf)
myItem.Body = mybody
 
Similar threads
Thread starter Title Forum Replies Date
S Emails Configured As HTML But Sent As Plain Text Using Outlook 13
A BCM 2010 converts html e-mails to plain text BCM (Business Contact Manager) 1
D Mail is received in Plain text even formatted and sent in HTML Outlook VBA and Custom Forms 1
M Plain text versus HTML email Outlook VBA and Custom Forms 1
D Outlook 2016 64bit, Cannot Save in 'HTML', format Using Outlook 1
K Outlook adds space to rows in HTML email signatures viewed on mobile Using Outlook 1
M HTML email signature in Outlook Using Outlook 1
B Outlook 2016 Unable to view images or logos on the outlook 2016 emails the same html code works well when i use outlook 2010 Using Outlook 0
I Outlook 2003 shows html code when To: field is empty Using Outlook 7
B Programmatically force html send and insert clipboard contents into body Outlook VBA and Custom Forms 0
S Change VBA script to send HTML email instead of text Outlook VBA and Custom Forms 3
U HTML Task Alternate Home Page View Control Using Outlook 3
D Custom form with html hyperlink Outlook VBA and Custom Forms 7
D Keep Original html body when forwarding an email Outlook VBA and Custom Forms 7
D create an html table in outlook custom form 2010 using vba in MsAccess Outlook VBA and Custom Forms 7
George Simpson "Switch to HTML" in Outlook 2016 notes field Using Outlook 1
H Search and delete part of a link inside HTML body message Outlook VBA and Custom Forms 2
S Outlook 2013 doesn't download html messages Using Outlook 0
A How can I load a HTML template into the WordEditor? Outlook VBA and Custom Forms 3
cabinet guy permanent response in html Using Outlook 1
C Signatures in HTML emails Using Outlook 5
I Outlook 2013 Appointments not in HTML Using Outlook.com accounts in Outlook 2
B Replies never HTML Using Outlook 2
L Outlook 2002: HTML Emails Will Not Print: Please Help Using Outlook 0
Diane Poremsky Outlook crashes when viewing HTML Messages New Slipstick.com Articles 0
Diane Poremsky Create a New Message using an HTML File or Stationery New Slipstick.com Articles 0
V incorrect html signature printed Using Outlook 2
Z alter the timeout for how long outlook looks for a content-server on an HTML-email? Using Outlook 5
Diane Poremsky Create a New Message using an HTML File or Stationery New Slipstick.com Articles 0
Y HTML Emails Using Outlook 1
A Lync meeting in outlook lose HTML formatting Using Outlook 3
C Outllok 2010 (14.0.7015.1000 (32bit) converts html mail to rich text when move Using Outlook 1
T HTML email for internal mesages and Text only for External? Using Outlook 1
C In need of VBA code to read / parse HTML - Outlook emails Using Outlook 0
M Unable to read HTML Using Outlook 2
V Name of attachment in replies (HTML) - possible?? Using Outlook 12
D Saving outlook emails in html and attachments Using Outlook 4
T Forcing HTML for replies in Outlook 2013 Using Outlook 4
M HTML mails apprearing broken in outlook 2013 Using Outlook 5
T Html tags in Message body Using Outlook 1
R OL2010; How to ALWAYS Reply/Forward using HTML? Using Outlook 1
J Outlook is not parsing html email, unreadable and attachment not decoded Using Outlook 1
A Calendar to Web HTML - Multiple Files Using Outlook 1
S HTML Contents of an email Jumbled in Outlook 2010 Client Using Outlook 5
F "MSG" type attachments are stripped away when senand previewed with HTML tags. Using Outlook 3
C Save as HTML for multiple emails Using Outlook 1
G No word wrap in HTML email. Using Outlook 8
M Mail in HTML format can't be sent if url or number is in the body Outlook 2010 Using Outlook 2
O Exchange 2003 displaying HTML emails as having attachments Exchange Server Administration 7
G Keyboarding with HTML Email in OL2010-64bit Using Outlook 0

Similar threads

Top