如何以编程方式更新 MS Word 2007 文档页眉中的字段(例如文件名)?

发布于 2024-07-27 15:47:59 字数 247 浏览 0 评论 0原文

以下代码仅更新页眉之外的字段。

ActiveDocument.Fields.Update

我还在 MSDN 论坛

The following code only updates the fields outside the page headers.

ActiveDocument.Fields.Update

I also asked the question on MSDN Forums

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

叫嚣ゝ 2024-08-03 15:47:59

好的,我找到了。

ActiveDocument.Sections(1).Headers(wdHeaderFooterPrimary).Range.Fields.Update

OK, I found it.

ActiveDocument.Sections(1).Headers(wdHeaderFooterPrimary).Range.Fields.Update
愿得七秒忆 2024-08-03 15:47:59

由于某种原因,杰弗里的回答对我不起作用。

最终,我使用大锤和炸药棒更新了页脚中的字段,如下所示:--

        wDoc.PrintPreview();
        wDoc.ClosePrintPreview();

Geoffrey's answer did not work for me for some reason.

Eventually I got the fields updated in my footers using a sledgehammer and a stick of dynamite like so:--

        wDoc.PrintPreview();
        wDoc.ClosePrintPreview();
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文