Fill Body of Email with contents of a Word file 
Author Message
 Fill Body of Email with contents of a Word file

I am writing a program that will automatically send an
email to my clients. Depending upon the type of client,
the body of the email is to contain the contents of a
Word document specific to that client type.

I have been able to create the email and send the
document as an attachment. However, I don't want to send
an attachment. I want the message to show up in the body
of the email.

Does anyone know how to do this?

Mike



Fri, 17 Dec 2004 20:01:49 GMT  
 Fill Body of Email with contents of a Word file
Mike,

Not sure you can do it with a word document because of all
the formatting, but you can certainly do it with a txt
file.

Dim ra 'place this above all routines so that it is global
in scope
Sub your code to create email
Getline
Set MyItem=CreateItem(olMailItem)
MyItem.Subject ="Test"
MyItem.Body=ra
MyItem.Display 'or MyItem.Send
End Sub
Function GetLine
   Const ForReading = 1, ForWriting = 2
   Dim fso, f
   Set fso = CreateObject("Scripting.FileSystemObject")
   Set f = fso.OpenTextFile("c:\testfile.txt", ForWriting,
True)
   ra =   f.ReadAll
   GetLine = f.Line
End Function

Hope this helps

Dave

Quote:
>-----Original Message-----
>I am writing a program that will automatically send an
>email to my clients. Depending upon the type of client,
>the body of the email is to contain the contents of a
>Word document specific to that client type.

>I have been able to create the email and send the
>document as an attachment. However, I don't want to send
>an attachment. I want the message to show up in the body
>of the email.

>Does anyone know how to do this?

>Mike
>.



Fri, 17 Dec 2004 22:20:06 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Automate email to have a body containing a Word RTF file

2. Newbie Emailing text file into body of Email

3. Word Doc As Email Body

4. Word Document to Outlook as an email body without loosing the formatting

5. make an HTML file the body of a new email message

6. Sending MHT files as Email Body

7. HELP-- filling an array with the contents of Excel-file performs too too too slow-- HELP

8. Fill a listbox with the contents of a file really fast

9. Paste item (not contents) into body of another item

10. Urgent: No body content

11. Content of Word- and excel-files

12. Sending an email with format in the body from A2K

 

 
Powered by phpBB® Forum Software