Problem creating HTMLBody infoormation in Outlook OlMailItem..

Posted on 2008-11-20
Last Modified: 2013-11-10
I have a VBA script which I'm running in Word to create emails containing the Word document and an  attachment.

It works fine except for the fact it uses

.Body = ActiveDocument.Content which removes all the formatting from the Word document.

I want to email the Word Document as it is, formatted.

I thought I would try .HTMLBody and do it that way, but I don't know  how to get the text contained in ActiveDocument.Content into an HTML Tag.

Any help appreciated.
Question by:chrisfixit
    LVL 5

    Expert Comment

    2 main options:

    1. Use Word-Api  to convert to html
    2. Send as attachment
    LVL 1

    Author Comment

    Ah thanks, any pointers to option one?

    The thing is this is for a hotel.

     They are mailing their travel agents and the like and have a preformatted Word Document with their      logo etc..the attachment is the latest price list.

    Up until now they have done it manually sending 20 or so at a time, but want to automate it.

    They also send the info to some clients by Fax, and it's important to them that the email looks similar to the Fax.
    LVL 5

    Accepted Solution

    Document.SaveAs(...) , with FileFormat set to WdSaveFormat.wdFormatHTML
    LVL 1

    Author Closing Comment

    Thanks, I'm now trying to convert VBA to VB .NET ;-)

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Here we come across an interesting topic of coding guidelines while designing automation test scripts. The scope of this article will not be limited to QTP but to an overall extent of using VB Scripting for automation projects. Introduction Now…
    Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
    Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

    794 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now