|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
Sub AsPDF() '另存为PDF
With Sheet8.PageSetup '登记表
.Zoom = 120
.Orientation = xlPortrait
.FitToPagesWide = 1
.FitToPagesTall = False
.PrintArea = Sheet8.Range("B1:H30").Address
End With
fname = ThisWorkbook.Path & "\" & Sheet8.Range("f3") & "登记表.pdf"
Sheet8.ExportAsFixedFormat Type:=xlTypePDF, Filename:=fname, Quality:=xlQualityStandard, IgnorePrintAreas:=False, IncludeDocProperties:=True ', OpenAfterPublish:=True '打开文件
Sheet8.PageSetup.PrintArea = ""
With Sheet8.PageSetup '记录
.Zoom = 100
.Orientation = xlLandscape
.FitToPagesWide = 1
.FitToPagesTall = False
.FirstPageNumber = 1 '设置第一页页码为1
.CenterFooter = "第 &P页, 共 &N页"
.PrintArea = Sheet8.Range("J3:S" & Sheet8.[J65536].End(xlUp).Row + 3).Address
End With
fname1 = ThisWorkbook.Path & "\" & Sheet8.Range("f3") & "记录表.pdf"
Sheet8.ExportAsFixedFormat Type:=xlTypePDF, Filename:=fname1, Quality:=xlQualityStandard, IgnorePrintAreas:=False, IncludeDocProperties:=True ', OpenAfterPublish:=True '打开文件
Sheet8.PageSetup.PrintArea = ""
End Sub
这段代码将登记表生成了一个纵向的PDF文档,将记录表生成一个横向的PDF文档(表太宽,只能横向显示)
VBA能否实现:只生成一个PDF文档,第一页为纵向,内容为登记表,从第2页开始为横向,内容为记录表
|
|