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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

from Access: open outlook & attach MSWord document

Status
Not open for further replies.

jmpWashDC

Technical User
Mar 19, 2002
35
US
Hi,
I've been trying different ways to solve this little problem all day....

From Access, I need to open outlook and attach an exisiting MSWord document.

I'm not getting anywhere with the DoCmd.SendObject command because the only objects this command is expecting are:
acSendDataAccessPage
acSendModule
acSendQuery
acSendTable
acSendForm
acSendNoObject
acSendForm

but I also see that a potential output format is
acFormatRTF

Is there a way to make it happen? I'm only a novice programmer!! This stuff is hard!!

jmp
 
This sample should steer you in the right way. Remember to set Outlook as a reference.

Dim oMailApp As New Outlook.Application
Dim oMail As MailItem

strAddressee = ""
strCC = ""
strBody = ""
strSubject = ""
strSalutation = ""

On Error GoTo HandleErr

strSubject = "LogGen Cmd:Load XML"
strAddressee = gstrAddressee
strBody = vbCrLf & "This LogGen Commanding message has been E-Mailed"
Set oMailApp = CreateObject("Outlook.Application")
Set oMail = oMailApp.CreateItem(olMailItem)
If Len(mstrAddressee) > 0 Then
oMail.To = mstrAddressee
Else
oMail.To = gstrAddressee
End If
If Len(strCC) > 0 Then
oMail.CC = strCC
End If
oMail.Subject = strSubject
oMail.Body = strBody
oMail.Importance = olImportanceHigh
oMail.Sensitivity = olPrivate
oMail.Attachments.Add GetRootPath & "XML\" & Me.cboSource
oMail.Display


Steve King Growth follows a healthy professional curiosity
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top