首页 > 解决方案 > ExportAsFixedFormat PDF 停止了 Office 365

问题描述

我是一个基础用户。我通常将我的 VBA 代码从谷歌搜索和 stackoverflow 建议拼凑在一起。我有一本使用"ExportAsFixedFormat Type:=xlTypePDF". 我有 4 行代码将工作表的各个页面保存到本地硬盘上的 PDF 中。自从我有了一台新计算机(也许是我升级到 Office 365 之后),我的宏一直返回此错误:

运行时错误“-2147417848 (80010108)”:

自动化错误

调用的对象已与其客户端断开连接。

这是我现在拥有的代码...

Sub Savepdf()

Worksheets("Weekly").ExportAsFixedFormat Type:=xlTypePDF, Filename:="C:\Users\directoryhere\pc2018summer.pdf", Quality:=xlQualityMinimum, IncludeDocProperties:=True, IgnorePrintAreas:=False, From:=1, To:=10
Worksheets("Weekly").ExportAsFixedFormat Type:=xlTypePDF, Filename:="C:\Users\directoryhere\pc2018fall.pdf", Quality:=xlQualityMinimum, IncludeDocProperties:=True, IgnorePrintAreas:=False, From:=11, To:=25
Worksheets("Weekly").ExportAsFixedFormat Type:=xlTypePDF, Filename:="C:\Users\directoryhere\pc2018winter.pdf", Quality:=xlQualityMinimum, IncludeDocProperties:=True, IgnorePrintAreas:=False, From:=28, To:=42
Worksheets("Weekly").ExportAsFixedFormat Type:=xlTypePDF, Filename:="C:\Users\directoryhere\pc2018.pdf", Quality:=xlQualityMinimum, IncludeDocProperties:=True, IgnorePrintAreas:=False

End Sub

标签: excelvbapdfexport

解决方案


推荐阅读