Saving an Excel document to PDF - VBA
Hi,
Basically i am trying to save my excel sheet to a PDF by using a VBA. What i have tried doing is saving the document under my current sheet name (as i have multiple sheets), so i dont have to edit the PDF afterwards in terms of name.
This is what ive got so far
Sub PDF()
Dim strXLName As String, strPDFName As String, intPos As Integer
strXLName = ActiveSheet.Name
intPos = InStr(1, strXLName, ".")
strPDFName = Left(strXLName, intPos) & "pdf"
ActiveSheet.ExportAsFixedFormat _
Type:=xlTypePDF, _
Filename:=strPDFName, _
Quality:=xlQualityStandard, _
IncludeDocProperties:=True, _
IgnorePrintAreas:=False, _
OpenAfterPublish:=True
End Sub
But this does not save it as the sheet name like i want it too?, even just a certain cell it saves it as would be alright?, any ideas?
|