Excel Save and attach pdf to Outlook Email

Joined
May 26, 2011
Messages
4
Reaction score
0
Hi!!

I'm trying save the first sheet of my workbook as a pdf then attach to an outlook email then view the email before sending. Everything works except for getting the pdf to attach. My code is all activiated by the button click event. Range("T2") is the file path where it is saved. It's

="S:\Common\MANUALS\QUALITY\IS\Notes\Furnace Notes"&TEXT(H1,"mmddyy")

the part of the code in bold seems to be the only part not working

Please help!! thanks
smile.gif


Sub SaveBtn_Click()
Dim FileName As String
Dim mypdf As String
Dim ThisFile As String
ThisFile = Range("T2").Value
With ActiveSheet
.ExportAsFixedFormat _
Type:=xlTypePDF, _
FileName:=ThisFile, _
OpenAfterPublish:=False
End With
mypdf = "S:\Common\MANUALS\QUALITY\Instrument Service\IS Forms Access Database\Furnace Notes" & Range("H1")

RDB_Mail_PDF_Outlook mypdf, "(e-mail address removed).com", "Meetin Summary" & "_" & Range("H1"), "This is a summary of today's " & vbNewLine & vbNewLine & "my name", False

End Sub


Function RDB_Mail_PDF_Outlook(FileName As String, StrTo As String, StrSubject As String, StrBody As String, Send As Boolean)
Dim OutApp As Object
Dim OutMail As Object
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
On Error Resume Next
With OutMail
.To = StrTo
.CC = ""
.BCC = ""
.Subject = StrSubject
.Body = StrBody
.Item.Attachments.Add FileName
.Display
End With
On Error GoTo 0
Set OutMail = Nothing
Set OutApp = Nothing
End Function
 
Back
Top