Hi Guys, hoping for some help, couldn't find a solution browsing the forums;
Have adapted some code as below which does work in theory, it creates a temp pdf from a set range, attaches it to an email and then Kills the file when complete - is there a way to rename this pdf attachment to a cell value in a named range before it gets attached? IE could I name the file based on the value BZ2 before attaching it?
Any help would be marvelous! Thankyou to all
Set xpdfemailtitle = Range("bz2")
strPath = ActiveWorkbook.FullName
lngPos = InStrRev(strPath, ".")
strPath = Left(strPath, lngPos) & "pdf"
Range("a1:k179").ExportAsFixedFormat xlTypePDF, strPath
Set emailApplication = CreateObject("Outlook.Application")
Set emailItem = emailApplication.CreateItem(0)
emailItem.Subject = xpdfemailtitle
emailItem.Attachments.Add strPath
emailItem.Display
Set emailItem = Nothing
Set emailApplication = Nothing
Kill strPath
End Sub
Have adapted some code as below which does work in theory, it creates a temp pdf from a set range, attaches it to an email and then Kills the file when complete - is there a way to rename this pdf attachment to a cell value in a named range before it gets attached? IE could I name the file based on the value BZ2 before attaching it?
Any help would be marvelous! Thankyou to all
Set xpdfemailtitle = Range("bz2")
strPath = ActiveWorkbook.FullName
lngPos = InStrRev(strPath, ".")
strPath = Left(strPath, lngPos) & "pdf"
Range("a1:k179").ExportAsFixedFormat xlTypePDF, strPath
Set emailApplication = CreateObject("Outlook.Application")
Set emailItem = emailApplication.CreateItem(0)
emailItem.Subject = xpdfemailtitle
emailItem.Attachments.Add strPath
emailItem.Display
Set emailItem = Nothing
Set emailApplication = Nothing
Kill strPath
End Sub