I saw another post with code that is helpful, but I think I have to change the .Body statement somehow:
Sub SendMessage() Dim objOutlook As Outlook.Application Dim objOutlookMsg As Outlook.MailItem Dim objOutlookRecip As Outlook.Recipient Dim objOutlookAttach As Outlook.Attachment
' Create the Outlook session. Set objOutlook = CreateObject("Outlook.Application")
' Create the message. Set objOutlookMsg = objOutlook.CreateItem(olMailItem)
With objOutlookMsg ' Add the To recipient(s) to the message. Set objOutlookRecip = .Recipients.Add("Britton, Steve") objOutlookRecip.Type = olTo
' Set the Subject, Body, and Importance of the message. ..Subject = "This is an Automation test with Microsoft Outlook" ..Body = "This is the body of the message." & vbCrLf & vbCrLf & _ "W:\purprod\public\Ellis\2008 Tracking Tools\PPV POs Top 10\PPV Report Forward Looking 11-06-08.xls" ..Importance = olImportanceHigh 'High importance
' Resolve each Recipient's name. For Each objOutlookRecip In .Recipients objOutlookRecip.Resolve Next
..Save ..Send
End With Set objOutlook = Nothing End Sub
"Bob V" wrote:
[Quoted Text] > I am just on my way to learning VBA, and it's been great so far. I wondered > if anyone had an idea of how to load the message text field (using SendObject > command in Access 2007) from a file or other source (like a text file), > instead of a fixed message?
|