excel在exportasfixedformat之后运行较慢

excel在exportasfixedformat之后运行较慢,excel,pdf,pdf-generation,export-to-pdf,Excel,Pdf,Pdf Generation,Export To Pdf,以下代码段正在Excel/Office 2007中运行: If Dir(Filenamepath) <> "" Then 'don't overwrite the packing list if it exists Else PackList.ExportAsFixedFormat Type:=xlTypePDF, _ FileName:=Filenamepath, _ OpenAfterPublish:=False 'True End If 在我的代码的开

以下代码段正在Excel/Office 2007中运行:

If Dir(Filenamepath) <> "" Then 'don't overwrite the packing list if it exists
Else
    PackList.ExportAsFixedFormat Type:=xlTypePDF, _
    FileName:=Filenamepath, _
    OpenAfterPublish:=False 'True
End If
在我的代码的开始,但我的实验结果保持不变,所以这似乎不是问题

为什么ExportAsFixedFormat会导致代码速度急剧下降,对此可以做些什么

2017年12月28日更新:仍然没有解决方案,但是从搜索导致Excel崩溃的ExportAsFixedFormat相关的其他问题(如35857728)来看,这是一个常见问题。最近,Excel在试图生成PDF时崩溃(但只是有时),而以前它运行缓慢。我尝试过更改默认打印机、卸载其他VBA宏、卸载Windows更新(其他用户提出的解决ExportAsFixedFormat问题的所有建议)。似乎没有什么帮助

唯一可行的解决方案是将导出的文件类型从PDF更改为XPS(另一个ExportAsFixedFormat选项)。对于我的情况,我可以使用XPS文件类型,并且我可以在以后将文件转换为PDF。我还没有验证这是否加快了宏(我最初的问题),但至少它似乎有助于崩溃)

  Application.ScreenUpdating = False
  Application.DisplayAlerts = False
  Application.EnableEvents = False
  Application.Calculation = xlCalculationManual