VBA Word - 查找和替换
我正在尝试在 Word 中创建一个 VBA 宏,它将搜索一些文本并对其应用特定的样式。在将其自动化之前,我尝试通过“查找和替换”工具手动执行此操作。这就是我正在做的...
- 打开一个包含以下文本的 Word 文档: 这是 Word 文档中的第一句话。
- 将短语“in the”加粗。
- 通过编辑打开查找和替换工具-->代替。
- 在“查找内容:”字段中只有格式:字体:粗体
- 在“替换为:”字段中只有格式:样式:标题 1
- 单击“全部替换”
注意整个句子如何更改为“标题 1” 。我只希望文档中“粗体”的区域位于“标题 1”中,而不是整个句子中。
我做错了什么?
I'm trying to create a VBA Macro in Word that will search for some text and apply a specific style to it. Before I automate it I'm trying to do it manually via the Find and Replace tool. Here's what I'm doing...
- Open a word document with the text: This is the first sentence in the word document.
- Make the phrase "in the" to be bold.
- Open up the Find and Replace Tool via Edit --> Replace.
- In the "Find what:" field only have Format: Font:Bold
- In the "Replace with:" field only have Format: Style:Heading 1
- Click on "Replace All"
Notice how the entire sentence has been changed to "Heading 1". I only wanted the areas in the document that were "bold" to be in "Heading 1" not the whole sentence.
What am I doing wrong?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
标题就是标题。
如果将句子的任何部分更改为标题 1,则整个句子将成为标题。如果您希望它更大,我的建议是增加字体大小而不是使其成为标题!
A Heading is a heading.
If you change any part of the sentence to Heading1 the whole sentence becomes the heading. If you want it to be bigger, my suggestion would be to increase the font size not make it a Heading!