Outlook Automation - SaveAs creates message with empty body 
Author Message
 Outlook Automation - SaveAs creates message with empty body

Hi,
Would anyone happen to know why a doing a
           .SaveAs EMAIL_SAVEPATH & "\" & p_msgName & ".msg", olMSG
would save a message with an EMPTY body, while doing a
           .SaveAs EMAIL_SAVEPATH & "\" & p_msgName & ".txt", olTXT
doesn't, for the same process?  It behaves like this though the only change
I make is comment one and uncomment the other.

When I do a
           .Display
right before the .SaveAs the text shows up in the message.

Also, when I make the bodyformat HTML and do a SaveAs Text, the text file is
empty.

<what follows is a part of a previous post, to give some background>

Hi,
I'm generating emails from Access and saving them as files.  I wanted to see
if I could minimize Outlook session openings and decided to move the
declaration outside of a main loop and function call.  So it looks something
like this:

    Dim objOL As Outlook.Application
    Set objOL = CreateObject("Outlook.Application")

    do while not r.eof
        [do some stuff]
        FUNCTION1 (objOL, [and other parameters to write the message])

    loop

Inside FUNCTION1 I have the following declarations

    Dim objOutlookMsg As Outlook.MailItem
    Dim objOutlookRecip As Outlook.Recipient
    Dim objOutlookAttach As Outlook.Attachment

and assign all the message components, and eventually get to a line:

    objOutlookMsg.SaveAs EMAIL_SAVEPATH & "\" & p_msgName & ".msg", olMSG

When I run this the email files get generated but they are empty.  When I
had the session declaration within FUNCTION1 the emails got generated fine,
but again, I want to limit the object calls to the session if possible.  I
did try doing a SaveAs of type TEXT and this worked fine.

Thanks,

G



Mon, 06 Sep 2004 16:48:14 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Please Help - Outlook Automation - SaveAs produces empty body

2. doing a saveas gives empty body

3. Creating Excel Spreadsheet from Outlook message body data

4. Retaining left indent in an Outlook message created from Word via Automation

5. empty Non-Deliverable report message body property

6. (*.RTF) as message body to Outlook, Possible???

7. Replacing message body text in Outlook 2000 7 XP

8. find/replace in outlook message body

9. Body property of Message in Outlook Object Model

10. Sending HTML In Body of Outlook Message using VBSCRIPT (WSCRIPT)

11. RichTextBox to Outlook Message Body

12. RichTextBox to Outlook Message Body

 

 
Powered by phpBB® Forum Software