- Katılım
- 20 Ekim 2013
- Mesajlar
- 83
- Excel Vers. ve Dili
- Excel 2013
Bendeki kod tüm sayfaları pdf'e çeviriyor. Ben sadece seçili alanı pdf'e çevirmesini ve bunu yaparken yatay mı düşey mi olacağını sormasını ve pdf'e ad verebilmeyi istiyorum.
Yardımcı olabilir misiniz?
Yardımcı olabilir misiniz?
Kod:
Sub Save_as_pdf()
Dim FSO As Object
Dim s(1) As String
Dim sNewFilePath As String
Set FSO = CreateObject("Scripting.FileSystemObject")
s(0) = ThisWorkbook.FullName
If FSO.FileExists(s(0)) Then
'//Change Excel Extension to PDF extension in FilePath
s(1) = FSO.GetExtensionName(s(0))
If s(1) <> "" Then
s(1) = "." & s(1)
sNewFilePath = Replace(s(0), s(1), ".pdf")
'//Export to PDF with new File Path
ActiveSheet.ExportAsFixedFormat _
Type:=xlTypePDF, _
Filename:=sNewFilePath, _
Quality:=xlQualityStandard, IncludeDocProperties:=True, _
IgnorePrintAreas:=False, OpenAfterPublish:=True
End If
Else
'//Error: file path not found
MsgBox "Error: this workbook may be unsaved. Please save and try again."
End If
Set FSO = Nothing
End Sub
Son düzenleme:
