如何控制“查看页面之间的空白”在 MS Word 中使用 VBA/宏?

发布于 2024-08-02 17:10:17 字数 65 浏览 1 评论 0原文

是否可以通过VBA/宏控制工具->选项->视图->“查看页面之间的空白”?

谢谢。

Is it possible to control the Tools->Options->View->"View Whitespace between pages" through VBA/Macros?

Thanks.

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

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

发布评论

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

评论(2

小矜持 2024-08-09 17:10:17

问题在于这些设置
似乎在随机变化
方式

,您无知的用户正在页面之间单击并隐藏空白。只需单击一下即可将其恢复。

要以编程方式执行此操作,请参阅此链接:

http://word.mvps.org/FAQs/ MacrosVBA/DocumentEvents.htm

将 AutoOpen 宏添加到每个人的 Normal.Dot 模板中并添加以下行

ActiveWindow.View.DisplayPageBoundaries = True

The problem is that these settings
appear to be changing in a random
manner

Actually your clueless users are clicking between the pages and hiding the whitespace. It's another simple click to get it back.

To do it programmatically see this link:

http://word.mvps.org/FAQs/MacrosVBA/DocumentEvents.htm

Add a AutoOpen macro into everyone's Normal.Dot template and add the line

ActiveWindow.View.DisplayPageBoundaries = True
晨敛清荷 2024-08-09 17:10:17

DJ 的观点是正确的:

ActiveWindow.View.DisplayPageBoundaries = True

但是,我会警告不要更改 Normal.dot 模板来自动格式化。该模板普遍影响Word的功能,最终用户需要控制自己的宏和宏。快捷方式(即使最终用户目前不编写/使用宏)。

缺点的一个示例是页眉/页脚可能变得不可见,并且如果默认活动文档在该区域被遮挡的情况下一直打开,则可能会令想要使用和查看页眉/页脚的最终用户感到沮丧。

DJ 建议的 Word MVP 页面非常好,我建议进一步深入研究“如何在不使用 Normal.dot 的情况下创建类似于 AutoOpen、AutoNew 和 AutoClose 的全局事件过程”​​部分。

可能需要阅读几遍,但值得努力了解如何创建仍执行“默认”操作的非默认模板。执行此操作后,添加或删除代码以使任意数量可用的宏就像将模板文件“xxxx.dotm”添加到 Word Startup 文件夹中一样简单,然后在出现错误时删除该模板文件。不再需要宏。

这样以后或者当您想要更改或更新代码时,就无需从用户的 normal.dotm 模板中分离出不需要的代码。还有很多其他技巧可以用来自动安装宏,让最终用户更好地控制附加宏,并让您更好地控制编写和更新代码,但这将是一个好的开始。

DJ is right on with:

ActiveWindow.View.DisplayPageBoundaries = True

However, I would caution against altering the Normal.dot template to automate formatting. This template affects the function of Word universally, and the end user needs to be in control of their own macros & shortcuts (even if the end user doesn't write/use macros presently).

An example of a drawback is that headers/footers may become invisible, and may frustrate end users who want to work with and view headers/footers if the default active document keeps opening with this area obscured.

The Word MVP pages DJ suggested are excellent, and I recommend digging even further to the section on "How to create global event procedures similar to AutoOpen, AutoNew and AutoClose, without using Normal.dot".

It may take several readings over, but it's worth the effort to understand how to create a non-default template that still performs "default" actions. Once you do this, adding or removing the code to make any number of macros available is as simple as adding your template file "xxxx.dotm" to the Word Startup folder, and removing the template file when the macros are no longer needed.

This removes the need to disentangle unwanted code from user's normal.dotm template later, or when you want to change or update code. There are plenty of other tricks that can be used automate the installation of macros, to give the end user better control over added-on macros, and to give you more control over writing and updating code, but this would be a good start.

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