删除Word中标题的宏
我有一个 WORD 文档,其中有许多 H1 标题。 我想要一个宏,允许我删除从特定 H1 标题到下一个 H1 标题的所有内容 - 本质上是删除 H1 部分。 同样,我可能想从 H2 标题中删除直到下一个 H1 或 H2 标题。
I have a WORD document with a number of H1 headings. I'd like a macro that allows me to delete all the contents from a specific H1 heading until the next H1 heading - essentially deleting the H1 section. Similarly I might want to delete from a H2 heading until the next H1 or H2 heading.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以使用 oParagraph.Style 确定段落的样式(其中 oParagraph 是 Paragraph 对象)。 所以,你可以这样做:
You can determine the style of a paragraph using oParagraph.Style (where oParagraph is a Paragraph object). So, you could do something like:
您不需要宏:在大纲视图中编辑文档。 导航到那里并仅选择标题级别 1,如下所示:
接下来,选择级别:
仅删除不再希望保留的 H1 标题。 您可以拖动& 删除标题,然后是从属内容。
这是根据需要进行大规模编辑的绝佳视图。
You don't need a macro: edit the document in Outline view. Navigate there and select only headings level 1, as follows:
Next, select the level:
Delete only the H1 headings you no longer want to keep. You can drag & drop headings, and the subordinate content will follow.
This is a great view for doing large-scale editing as you require.