E-mail pdf using Access Macro

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi. I was asking the other day how to make a snapshot report a pdf. I finally
got that to work using a macro printing to Acrobat Writer driver, but now how
can I e-mail the saved pdf file? I've tried "send object", but the file
doesn't get attached. I'm not very good at VBA.
 
I got this from Arvin Meyer in a previous post.

Private Sub Command0_Click()
'Arvin Meyer 03/12/1999
'Updated 7/21/2001
On Error GoTo Error_Handler

Dim objOutlook As Outlook.Application
Dim objEmail As Outlook.MailItem

Set objOutlook = CreateObject("Outlook.application")
Set objEmail = objOutlook.CreateItem(olMailItem)

With objEmail
.To = "(e-mail address removed)"
.Subject = "Look at this sample attachment"
.body = "The body doesn't matter, just the attachment"
.Attachments.Add "C:\Test.htm"
'.attachments.Add "c:\Path\to\the\next\file.txt"
.Send
'.ReadReceiptRequested
End With

Exit_Here:
Set objOutlook = Nothing
Exit Sub

Error_Handler:
MsgBox Err & ": " & Err.Description
Resume Exit_Here

End Sub

Good luck
Jim
 
Thanks, Jim. Where do I put this command? Can I run it from the macro that
creates the pdf file?

Thanks!

Liz
 
Back
Top