打印PDF文件时,怎么才能控制输出的PDF文件的路径和文件名?
利用虚拟打印机生产PDF文件,储存的时候要怎样才能控制PDF文件的文件名和路径
谢谢 各位了
帮你顶起来吧
我也在考虑这个问题
如果每次都自己输入文件名也太麻烦了 我有好几百张图呢
设置一个pc3打印机,在该打印机的设置里设置好pdf的输出路径,每次打印都用该打印机就行了 Public
Sub MakePDF(ByVal strPDFFileName As
String)
' Define the postscript and .pdf file names.
Dim strPSFileName As
String
Dim xlWorksheet As Worksheet
Dim objPdfDistiller As PdfDistiller
strPSFileName = Left(strPDFFileName, InStrRev(strPDFFileName, "\")) & "tmpPostScript.ps"
' Print the Excel ActiveSheet to the postscript file
Set xlWorksheet = ActiveSheet
Call xlWorksheet.PrintOut(copies:=1, preview:=False, ActivePrinter:="Acrobat Distiller", printtofile:=True, collate:=True, prtofilename:=strPSFileName)
' Convert the postscript file to .pdf
Set objPdfDistiller = New PdfDistiller
Call objPdfDistiller.FileToPDF(strPSFileName, strPDFFileName, "")
' Finally, delete the postscript file
Call Kill(strPSFileName)
End
Sub
参考以下这个代码哦 会有帮助的
页:
[1]