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!

SaveFile as PDF

Status
Not open for further replies.

dipitiduda2

Technical User
Mar 17, 2003
18
US
Hello,

I recently found coding on your site that saves a MS Access file to .pdf and then emails it using MS Outlook (see faq703-2533). I have attempted to run my code and keep receiving this MsgBox error "User-defined type not defined" at line:
Dim appOutLook As Outlook.Application

See my coding below for the CLICK event. I'm just learning vb 6.0 and am unsure how to fix this problem. I may have other coding problems with this CLICK event....haven't gotten that far yet. Any help is greatly appreciated. I'm running Office XP with Windows 2000/NT 5.0 environment. Thanks!

Private Sub cmdPreviewRpt_Click()
On Error GoTo Err_cmdPreviewRpt_Click

Dim stDocName As String
Dim Name As String
Dim appOutLook As Outlook.Application
Dim MailOutLook As Outlook.MailItem
Set appOutLook = CreateObject("Outlook.Application")
Set MailOutLook = appOutLook.CreateItem(olMailItem)

Name = InputBox("Enter the name for the PDF file:", "PDF")

Call SaveReportAsPDF("rpt_ExpenseRpt", "C:\work\" & Name & ".pdf")

With MailOutLook
.To = "Forms!frmOrder!PEmail"
.Subject = "mail subject"
.HTMLBody = "a HTML Body if needed"
.Attachments.Add "C:\Work\" & Name & ".pdf", olByValue, 1, "" & Name & ".pdf"
.Display
End With
stDocName = "rpt_ExpenseRpt"
DoCmd.OpenReport stDocName, acPreview

Exit_cmdPreviewRpt_Click:
Exit Sub

Err_cmdPreviewRpt_Click:
MsgBox Err.Description
Resume Exit_cmdPreviewRpt_Click

End Sub

 
did u reference the outllok dll? user project-->reference and select the Outlook entry there (i dont know correctly what file).

Known is handfull, Unknown is worldfull
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top