Sub save_pdf_email()
' Don't use "/" for folder name on PC
wd = InputBox("Please enter the folder name:", "Folder Name")
If Right(wd, 1) <> "\" Then wd = wd & "\"
nf = InputBox("Please enter the pdf file name:", "Filename Name")
If LCase(Right(nf, 4)) <> ".pdf" Then nf = nf & ".pdf"
nf = wd & nf
ThisWorkbook.ExportAsFixedFormat Type:=xlTypePDF, Filename:=nf
'email
Dim OutApp As Object
Dim OutMail As Object
mTo = InputBox("please enter the e-mail address to send the file:", "e-mail")
If mTo <> "" Then
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
On Error Resume Next
With OutMail
.To = mTo
.CC = ""
.BCC = ""
.Subject = "PDF file saved from excel"
.Body = "Attached please find the pdf file you requested."
.Attachments.Add nf
.Display
End With
On Error GoTo 0
Set OutMail = Nothing
Set OutApp = Nothing
End If
End Sub