Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

mail merge (attaching a text from word doc to body of email)

Status
Not open for further replies.

AT76

Technical User
Apr 14, 2005
460
US
In my Access app I executing a mail merge. The mail merge works fine but I would likle to attach contents of a word doc to the body of the email. Is this possible? I know you can attach a string to the body of the email, but how do you specify a specidic location of the word document and then attach its contents to the body of the email?

Thank you for any help provided!
 
Sorry...looks like that won't work for you. Docmd.Sendobject only works with objects within your Access database. It won't work for a Word doc.
 
Yes, I'm using outlook. I will read! Thanks!
 
rjoubert, I tried the following code:

Code:
    Dim fso As FileSystemObject
    Dim MyBody As TextStream
    Dim MyBodyText As String
    Dim BodyFile As String


    Set fso = New FileSystemObject
    BodyFile = "W:\MATERIAL\SURPLUS\ReturnsNA\body.doc"

   ' Since we got a file, we can open it up.
    Set MyBody = fso.OpenTextFile(BodyFile, ForReading, False, TristateUseDefault)

   ' and read it into a variable.
    MyBodyText = MyBody.ReadAll
    
    objSafeMail.Body = MyBodyText

   ' and close the file.
    MyBody.Close
    objSafeMail.Send

What I got in the body of the email (ÐÏࡱá
) was not what I had in the word doc.

Any ideas as to why? Thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top