选择所有的纸张并打印成单个pdf文件 [英] Select all sheets and print into single pdf file

查看:122
本文介绍了选择所有的纸张并打印成单个pdf文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将所有表单打印到一个pdf文件中。



我尝试过:

  Private Sub CommandButton9_Click()

ActiveWorkbook.Sheets.Select
带有选择
.ExportAsFixedFormat类型:= xlTypePDF,文件名:= _
E:\tempo.pdf,质量:= xlQualityStandard,IncludeDocProperties:= True,_
IgnorePrintAreas:= False,OpenAfterPublish:= True
End with

End Sub

我有一个消息:方法选择对象表单失败。 / p>

谢谢!

解决方案

而不是 .export ...
使用 activeworkbook.export ...
每张表将按照您的打印方式显示



或使用变量,例如:

  Sub Button1_Click()
Dim wb As Workbook,Fnm As String

设置wb = ThisWorkbook
Fnm =C:\U sers\Dave\Downloads\TestMe.pdf

wb.ExportAsFixedFormat类型:= xlTypePDF,文件名:= Fnm

End Sub


I want to print all sheets to a single pdf file. an each sheet would be on the beginning of new page.

I've tried with:

Private Sub CommandButton9_Click()

 ActiveWorkbook.Sheets.Select
 With Selection
 .ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
 "E:\tempo.pdf", Quality:=xlQualityStandard, IncludeDocProperties:=True, _
 IgnorePrintAreas:=False, OpenAfterPublish:=True
End With

End Sub

I've got a message :"Method 'Select' of object 'Sheets' failed."

Thanks!

解决方案

instead of activesheet.export... Use activeworkbook.export... Each sheet will display by how you have the print setup for each sheet set.

Or use Variables such as:

Sub Button1_Click()
    Dim wb As Workbook, Fnm As String

    Set wb = ThisWorkbook
    Fnm = "C:\Users\Dave\Downloads\TestMe.pdf"

    wb.ExportAsFixedFormat Type:=xlTypePDF, Filename:=Fnm

End Sub

这篇关于选择所有的纸张并打印成单个pdf文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆