|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
本帖最后由 心梦情缘 于 2019-8-27 12:41 编辑
各位大神,我下面这个是excel转PDF,使用的都是office2007,有的电脑运行没问题,有点电脑运行就报“5”错误,也就是提示红色哪里有问题,那位大神帮忙,帮我看看哪里问题。
Sub model()
Dim Path As String
Dim Filename1 As String
Dim Filename2 As String
Set wbAWB = Application.ActiveWorkbook
d = Format(Date, "yyyymmdd")
t = Format(Time, "hhMMss")
'configure title
FName3 = "CAPA" & "-" & d & t
'configure destination path
Path = "D:\cpk"
' Save as pdf
Path2 = Environ("Temp")
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
Path2 & "\" & FName3 & ".pdf", Quality:= _
xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=False
Set FSO = CreateObject("Scripting.FileSystemObject")
FSO.moveFile Path2 & "\" & FName3 & ".pdf", Path & "\" & FName3 & ".pdf"
ActiveWorkbook.FollowHyperlink Path & "\" & FName3 & ".pdf"
End Sub
|
|