使用 VBA 和“保护文档”功能的 Microsoft Word 保护样式 特征

发布于 2024-07-10 09:01:26 字数 311 浏览 5 评论 0原文

我试图限制用户可以在 Word 2003 文档中使用的样式。 我通过使用“保护文档”功能来执行此操作。 对于我的情况,我可能需要使用 VBA,但我不确定。

保护文档后,我无法再仅将样式应用于单个单词而不更改整个段落的样式。

例如,如果我尝试将下面句子中的“house”一词更改为新样式...

There is a house on the hill.

那么整个句子将变成该样式,而不仅仅是词房子。 有谁知道如何使用 VBA 解决这个问题或者知道我做错了什么?

谢谢!

I am trying to limit the styles a user can use in a Word 2003 document. I am doing this by using the "Protect Document" feature. For my situation I may need to use VBA but I am not sure.

After I protect the document, I can no longer apply a style to just a single word without it changing the style for the whole paragraph.

For example if I tried to change the word 'house' to a new style in the sentence below...

There is a house on the hill.

Then the whole sentence would become that style, not just the word house.
Does anyone know how to get around this using VBA or know what I am doing wrong?

Thanks!

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

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

发布评论

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

评论(1

夏夜暖风 2024-07-17 09:01:26

在“样式和格式”窗格中,查看带有字母“a”的样式
在它们旁边(而不是段落标记 ¶)。 这些是字符样式。 为了
例如,“强调”样式应用斜体,“强”样式应用粗体。
您可以为自己的模板定义其他字符样式; 只需更改
新样式对话框中的“样式类型”下拉列表从段落到字符。

在“保护文档”窗格中,选中“限制格式”框后,单击
点击其下方的“设置”链接,然后选择您想要允许的样式。 你可以
在那里选择字符样式以及段落样式。 用户可以申请
无论哪种样式,只要它是您允许的列表中的样式即可。

In the Styles and Formatting pane, look at the styles that have the letter 'a'
next to them (instead of the paragraph mark ¶). Those are character styles. For
example, the Emphasis style applies italics, and the Strong style applies bold.
You can define other character styles for your own templates; just change the
"Style type" dropdown in the New Style dialog from Paragraph to Character.

In the Protect Document pane, after checking the "Limit formatting" box, click
the Settings link below it and choose the styles you want to allow. You can
choose character styles there as well as paragraph styles. The users can apply
either kind of style, as long as it's a style in the list you allowed.

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