简体   繁体   English

ExportAsFixedFormat for VBA 保存文件

[英]ExportAsFixedFormat for VBA saving Files

i have a problem regarding the process of saving a bunch of pdfs (exported from WordDocuments).我在保存一堆 pdf(从 WordDocuments 导出)的过程中遇到问题。 The runtime of my program just behaves a bit weird and thats why i am asking.我的程序的运行时行为有点奇怪,这就是我问的原因。 So I want to save the files on a global drive.所以我想将文件保存在全局驱动器上。 In my program i create a folder (in that drive where) i put all the pdfs.在我的程序中,我创建了一个文件夹(在那个驱动器中)我放置了所有的 pdf。

Somehow if i do this operation for the first time it is really slow.不知何故,如果我第一次执行此操作,它真的很慢。

But if I do this operation ( for the same fodler a second time) it is somehow really fast.但是,如果我执行此操作(第二次为同一个 fodler 执行此操作),它会以某种方式非常快。 (after I deleted the "old" pdfs, or the old pdfs where overwritten) (在我删除了“旧” pdf 文件或被覆盖的旧 pdf 文件之后)

I am a bit frustrated and I cannot explain why that is我有点沮丧,我无法解释为什么会这样

Could somebody help pls Would be very happy for an answer有人可以帮忙吗 很高兴得到答案

Greetings Jonas问候乔纳斯

Using this simple code使用这个简单的代码

doc.ExportAsFixedFormat wholefile, ExportFormat:=wdExportFormatPDF

There are multiple reasons why the ExportAsFixedFormat method can be slow. ExportAsFixedFormat方法运行缓慢的原因有多种。 But I would start from dealing with local files only.但我会从只处理本地文件开始。 Then I'd play with arguments specifying the document quality and exported format.然后我会使用 arguments 指定文档质量和导出格式。 It makes sense to play with other parameters left in your code sample to its default values.将代码示例中的其他参数设置为其默认值是有意义的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM