Controlling Outlook from a Word Macro?

D

david_alex_smith

Hello,

My problem is this:

I want to have a macro that prints a doc to PDF (i can do this bit), then
opens up an outlook mail message with the generated PDF already listed as an
attachment.

Can anyone tell me if it's possible to do this, and if so, how?

Thanks.
 
H

Helmut Weber

Hi David,

like this:

Sub OutlookX()
' reference to outlook set
' = early binding

Set MyOutlook = CreateObject("Outlook.Application")
Set mymail = MyOutlook.CreateItem(olMailItem)

mymail.Subject = "Fac simile"
mymail.To = "[email protected] "
mymail.Body = "" ' not necessary
mymail.attachments.Add "c:\test\test.doc" ' or your PDF
mymail.Display ' or send of course !
'mymail.send

Set MyOutlook = Nothing '!
Set mymail = Nothing '!

End Sub


--
Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"
 
Top