Mapi - format message

Posted on 2005-04-06
Last Modified: 2012-05-05
I am using MAPI to send e-mail automatically from and Access database. I have a table of standard messages. The field in the table is called "EMailMessage" and its type is Memo.
When creating the message in the table I format it, so for example it will look like this:
"Dear Sir
Thank you for you help
Kind regards

When creating the message I use the code:
MapiMessages.MsgNoteText = EMailMessage 'where EMailMessage is the message retreived from the database.

However the text comes out like this:
"Dear Sir Thank you for you help Kind regards TimP"

how can I keep its original format?
Question by:TimTDP
    LVL 32

    Expert Comment

    by:Robberbaron (robr)
    You need to check how a DB memo field stores Carriage Return/LineFeed CRLF characters.

    Then search the returned memo field for the correct delimiter & replace with vbCrLf  (o chr13+ chr10)

    But as far as I know, the memo field should have the crlf in it.

    Author Comment

    I use Mozilla Thunderbird as my e mail client

    Chr(10) and Chr(13) do not work. The correct code is "<br>"

    LVL 32

    Accepted Solution

    Then i think you should walk through the text returned by the DB Memoi field & replace CRLF with <BR>

    dim mf as string,i as integer,j as integer
    for i=1 to len(mf)
      if mid(mf,i,2)=vbcrlf then
        mf=left(mf,i) & "<BR>" & mid(mf,i+2)
      end if
    next i

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Highfive + Dolby Voice = No More Audio Complaints!

    Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

    Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
    You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
    As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
    Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

    737 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

    16 Experts available now in Live!

    Get 1:1 Help Now