[英]there is a way to save a pdf file with a path folder name of the excel file+vba?
[英]Export to PDF and Prompt User for Folder Path and File Name to Save
我不知道如何提示用戶輸入文件夾路徑和保存名稱。 下面是我要工作的代碼。
Sub PrintToPDF
ThisWorkbook.Sheets("Sheet 1","Sheet 3").Select
ActiveSheet.ExportAsFixedFormat _
Type:=xlTypePdf, _
Filename:="test.pdf",
Quality:=xlQualityStandard, _
IncludeDocumentProperties:=True, _
IgnorePrintAreas:=False, _
OpenAfterPublish:=True
Sheets("Sheet 1").Select
End Sub
謝謝您的幫助!
下面的代碼將提示用戶選擇一個位置和文件名,將pdf保存為。
Dim file_name As Variant
file_name = Application.GetSaveAsFilename(FileFilter:="Adobe PDF File_ (*.pdf), *.pdf")
If file_name <> False Then
ActiveWorkbook.SaveAs Filename:=file_name
MsgBox "File Saved!"
End If
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.