【发布时间】:2020-01-06 18:39:33
【问题描述】:
对这个有点疯狂。不知道为什么这段代码不起作用。我的 PDF 文件正在保存,但它保存到我的 Documents 文件夹而不是定向文件。它需要进入这个文件来保存文档,我还有另一个代码可以发送电子邮件并从这个目录附加这个文件。
Sub PrintPOPDFtoFolder()
ChDir "R:\Procurement\Purchase Orders" & "\" 'files directory
fileSaveName = ActiveSheet.Range("Q7") 'Name the PDF file
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
fileSaveName _
, Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas _
:=False, OpenAfterPublish:=False
MsgBox "File Saved " & " " & fileSaveName
End Sub
【问题讨论】: