Results 1 to 5 of 5
  1. #1
    2 Star Lounger
    Join Date
    Jan 2001
    Location
    Wellington, Wellington, New Zealand
    Posts
    120
    Thanks
    0
    Thanked 0 Times in 0 Posts

    How to use VB to change message format in Outlook (Outlook 2000 & XP)

    I have a little macro in Outlook that is designed to create a new e-mail message with the content already filled in with standard text and with a particular file attached. The problem that I have is that this macro works fine in Outlook XP but when I run it in Outlook 2000 the mail message that it creates is in the "rich text format" which I know, from painful experience, many e-mail clients cannot read. Whilst I can manually change the mail format easily enough, my problem is how do I do this within the macro? No doubt it is easy but I've seen nothing in the help files despite much fruitless time spent searching. (the default message format in the Outlook 2000 I'm using is "plain text" - I checked that one already!!)
    Here is the macro:
    Public Sub BowenMsg()
    Dim myContent As String

    myContent = "some bunch of text, the contents of which are not relevant"
    myContent = myContent + Chr(13) + Chr(13) + "the next bunch of text and so on

  2. #2
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: How to use VB to change message format in Outlook (Outlook 2000 & XP)

    Very bad news: there's no way to change it through the object model. SendKeys generates an irritating warning about losing pictures (well, at least going from HTML to Plain Text it does). If you find a better answer, I would LOVE to know about it.

    There is something at Slipstick.com that surreptitiously creates or allows you to access an RTFBody property. I don't know if clearing that to vbNullString would flip the format because I haven't installed whatever it was that did that. Might be worth trying.

  3. #3
    Super Moderator
    Join Date
    Jan 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    3,852
    Thanks
    4
    Thanked 259 Times in 239 Posts

    Re: How to use VB to change message format in Outlook (Outlook 2000 & XP)

    I would attack this problem from another direction.

    Can you create an example of the email in Outlook and then save it as an Outlook Template (OFT) file. This can then be opened to give you a brand new blank to which you can add an addressee and send. VBA automation could then just execute that file and add the addressee information before sending it.
    Andrew Lockton, Chrysalis Design, Melbourne Australia

  4. #4
    2 Star Lounger
    Join Date
    Jan 2001
    Location
    Wellington, Wellington, New Zealand
    Posts
    120
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: How to use VB to change message format in Outlook (Outlook 2000 & XP)

    Thank you for the bad/sad news. I thought that I was onto something when I found the "olBody Format " property and one of the choices was "olFormatPlain" which worked a treat until I tried it out on the machine with Outlook2000 - crash and burn!!.
    The thing that I don't understand is that the documentation is *very* clear that using .Body will invoke "the default editor" which, in this case is most definitely plain text. I can get arounbd the RTF problem by using .HTMLBody which creates an HTML message - better than Rich Text as most people can deal with HTML messages (and there is always a plain text version sent along with it...).
    I haven't followed up the Slipstick suggestion but if I do I'll let you know what happens. Thanks again.

  5. #5
    2 Star Lounger
    Join Date
    Jan 2001
    Location
    Wellington, Wellington, New Zealand
    Posts
    120
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: How to use VB to change message format in Outlook (Outlook 2000 & XP)

    That's a good suggestion, thank you - I tried CreateItemFromTemplate and that works just fine - it also has the advantage that the text of the e-mail is able to be changed by someone who knows nothing about VB and that is probably a good thing.
    Your timely suggestion reminded me that the definition of insanity is trying the same thing over and over again and expecting a different result!! Thanks for your help.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •