CreateObject("Wscript.Shell").Run ("pdf文件路径+名称")
' 如:CreateObject("凳清Wscript.Shell").Run ("F:\pdf\ABC.pdf"陆粗伏)
End Sub
Sub openpdf()Dim path$
Dim name$
Dim fullname$
name = InputBox("请猜念输入文件名举租称(不含扩展名)")
path = "G:\360data\重要数据\桌面\"
fullname = path & name & ".pdf"
CreateObject("Wscript.Shell").Run 穗答困(fullname)
End Sub
首先,加载引用,如图
然后,在打印机中对Acrobat Distiller的打印进行设置设置(亏茄必须,否则乱磨转化出错!)
Public Sub MakePDF(ByVal strPDFFileName As String)
Dim strPSFileName As String
Dim xlWorksheet As Worksheet
Dim objPdfDistiller As PdfDistiller
strPSFileName = Left(strPDFFileName, InStrRev(strPDFFileName, "销陪察/")) &"tmpPostScript.ps"
Set xlWorksheet = ActiveSheet
Call xlWorksheet.PrintOut(copies:=1, preview:=False, ActivePrinter:="Acrobat Distiller", printtofile:=True, collate:=True, prtofilename:=strPSFileName)
Set objPdfDistiller = New PdfDistiller
Call objPdfDistiller.FileToPDF(strPSFileName, strPDFFileName, "")
Call Kill(strPSFileName)
End Sub
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)