Sub Email_Auth()
'Variable declaration
Dim msg As String, cell As Range
Dim Recipient As String, Subj As String, HLink As String
Dim Recipientcc As String, Recipientbcc As String, MailTxt As String
Recipient = Range("i37").Value
Recipientcc = ""
Recipientbcc = ""
'You can use a cell value also like this
'Recipient = Sheets("mysheet").Range("A1").Value
Subj = "Authorization for work"
'Subj = Sheets("mysheet").Range("A2").Value
msg = "Dear customer please sign and return the work Authorization in order to get the job started" & vbNewLine & vbNewLine
msg = WorksheetFunction.Substitute(msg, vbNewLine, " ")
'Turns off screen updating
Application.ScreenUpdating = False
'Create PDF of active sheet only
ActiveWindow.ScrollWorkbookTabs Position:=xlFirst
Sheets("insurance authorization").Select
strPath = Environ$("temp") & "\" 'Or any other path, but include trailing "\"
strFName = ActiveWorkbook.Name
strFName = Left(strFName, InStrRev(strFName, ".") - 1) & "_" & ActiveSheet.Name & ".pdf"
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, FileName:= _
strPath & strFName, Quality:=xlQualityStandard, _
IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=False
'Set up outlook
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
'Create message
On Error Resume Next
With OutMail
.To = Recipient
.Subject = Subj
'.Body = ""
.httpbody = ""
.Attachments.Add strPath & strFName
.Display 'Use only during debugging ##############################
'.Send 'Uncomment to send e-mail ##############################
End With
'Delete any temp files created
Kill strPath & strFName
On Error GoTo 0
Set OutMail = Nothing
Set OutApp = Nothing
Sheets("Claim Sheet").Select
End Sub
Bookmarks