Word 2003 - 如何使用宏更改样式?
是否可以创建 Word 2003 宏来更改文档某些部分的字体样式?
例如,假设我有一个文档,其中大部分文本为粗体斜体和 12 号字体。我想用带下划线的 14 点字体替换具有这些特征的所有文本。
我已经在 Google、StackOverflow 和 Microsoft 网站 上进行了一些搜索但我还没有找到任何讨论这是否可能的内容。
有什么帮助吗?
Is it possible to create a Word 2003 Macro to change the font style of certain segments of a document?
For example, say I have a document that has a large portion of text as bold italic and 12 point font. I'd like to replace all text with these characteristics with underlined 14 point font.
I've already done some searches on Google, StackOverflow and Microsoft's website but I haven't been able to find anything that discusses if this is even possible.
Any help?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
是的,您需要使用
.Find
对象及其子.Replacement
内容。您可以对选择
(有限运行)、范围
(段落、故事等)或整个文档执行此操作。下面的示例适用于整个文档 (ActiveDocument.Content
)。Yeah, you'll want to use the
.Find
object and it's child.Replacement
content. You can do this on aSelection
(limited run), aRange
(paragraphs, stories, etc.) or the whole document. The sample below is for the whole document (ActiveDocument.Content
).与往常一样,Word 的宏记录器可以提供很大的帮助:(
要生成宏,请启动宏记录器,按 Ctrl+H 打开“查找和替换”,然后指定适当的查找格式和替换格式)
As always, Word's macro recorder can be of great help:
(To generate the macro start the macro recorder, press Ctrl+H to open Find & Replace and then specify the appropriate find format and replacment format)