我想在将特定单元格选择导出为 PDF 时通过“另存为”对话框提示用户。我找到了 .SaveAs 方法,但我很难理解如何将它用于特定的单元格范围。
Private Sub Selection_promptSaveAs_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
End Sub
Selection
对象有一个方法:
Selection.ExportAsFixedFormat Type:=xlTypePDF, _
FileName:=file_name, Quality:=xlQualityStandard, _
IncludeDocProperties:=True, IgnorePrintAreas:=False, _
OpenAfterPublish:=False