Hi
Thanks all. I managed to piece it all together. The code below need cleaned up but it work if anyone needs it in future.
Private Sub cmdcomplete_Click()
On Error GoTo Err_cmdcomplete_Click
Dim stDocName As String
Dim stQuoteID As String
Dim stFileName As String
Dim stQuoteFile As String
Dim stEmailAddr As String
Dim prt As Printer
Dim oOutlook As Outlook.Application
Dim oEmailItem As MailItem
' Get the Printer object for the selected printer.
Set prt = Application.Printers("Win2PDF")
' Set the selected printer as the default printer for this session.
Set Application.Printer = prt
Me.Visible = False
Forms!frmcustomers.Visible = False
stQuoteID = "[QuoteId] = " & Me.[QuoteID]
stQuoteFile = Me.QuoteID
stEmailAddr = Me.ContactEmail
stDocName = "RptCustomerQuote"
stFileName = "C:\Sales\Quotes\" & stQuoteFile & ".pdf"
SaveSetting "Dane Prairie Systems", "Win2PDF", "PDFFileName", stFileName
DoCmd.OpenReport stDocName, acNormal, , stQuoteID
Me.cmdclose.Enabled = True
Me.cmdclose.SetFocus
Me.cmdcomplete.Enabled = False
Me.cmdsave.Enabled = False
Me.cmdcancel.Enabled = False
On Error Resume Next
Set oOutlook = GetObject(, "Outlook.Application")
If oOutlook Is Nothing Then Set oOutlook = CreateObject("Outlook.Application")
Set oEmailItem = oOutlook.CreateItem(olMailItem)
With oEmailItem
.Attachments.Add stFileName
.To = stEmailAddr
.Display
End With
Set oEmailItem = Nothing
Set oOutlook = Nothing
Exit_cmdcomplete_Click:
Exit Sub
Err_cmdcomplete_Click:
MsgBox Err.Description
Resume Exit_cmdcomplete_Click
End Sub