excel - 选定范围另存为 PDF
问题描述
例如,使用 Excel VBA,我想将 A1 和 J26 之间的区域保存为 pdf,但由于它不适合,它将 A1 保存到 E26。我应该如何通过在页面上安装来保存我选择的区域?我使用的代码如下。
With Sheets(1).Range("A1:J26")
.ExportAsFixedFormat _
Type:=xlTypePDF, _
Filename:="C:\File_Name_Test.pdf", _
Quality:=xlQualityStandard, _
IncludeDocProperties:=True, _
IgnorePrintAreas:=False, _
OpenAfterPublish:=False '
End With
解决方案
下面的代码看到了我的工作,谢谢
With Sheets("Sayfa1").PageSetup
.Orientation = xlPortrait
.PaperSize = xlPaperA4
.FirstPageNumber = xlAutomatic
.Order = xlDownThenOver
.Zoom = False
.FitToPagesWide = 1
.FitToPagesTall = 1
.PrintErrors = xlPrintErrorsDisplayed
.ScaleWithDocHeaderFooter = True
.AlignMarginsHeaderFooter = True
End With
With Sheets("Sayfa1").Range("A1:J22")
.ExportAsFixedFormat _
Type:=xlTypePDF, _
Filename:="D:\_AppData_\Desktop\File_Name22.pdf", _
Quality:=xlQualityStandard, _
IncludeDocProperties:=True, _
IgnorePrintAreas:=False, _
OpenAfterPublish:=False '
End With
推荐阅读
- algorithm - 用 1 和 0 填充 n*n 数组
- javascript - 矩对象数组具有未定义的元素
- sql-server - SQL Server 死锁问题;多个进程更新同一个表但不同的行
- azure - 将 SAML 请求编码到 Azure AD 终结点的正确方法是什么?
- javascript - 将 API 密钥存储到 credentials.yml.enc 的正确方法?
- css - 具有自定义验证的 Angular 组件
- python - 程序不会完全通过代码运行(无错误) Python 2.7.15
- ios - 中心滚动视图对象到每个水平滚动页面 - Xamarin iOS
- x86 - 为什么 NEG 指令会干扰进位标志?
- python - 对 pandas 中的多层次数据进行子集化