如何在MS Word中每个标题的末尾应用宏? [英] How to apply macro at end of every heading in MS Word?
本文介绍了如何在MS Word中每个标题的末尾应用宏?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个带有不同标题的文档(因此不一定是标题1或标题2-而是所有类型的标题).
I have a document with various headings (so not necessarily Heading 1 or Heading 2 - but all types of headings).
我想要做的是编写一个宏,例如,它将在每个标题的末尾删除2个空格.
What I'm trying to do is write a macro that will, for example, delete 2 spaces at the end of each heading.
例如,我们有
在标题末尾,我将做:
Selection.Delete Unit:=wdCharacters, Count:=2
我需要在每个标题的末尾应用它.
I need this to be applied at the end of each heading.
有人知道该怎么做吗?
推荐答案
转到第一个标题:
Selection.GoTo What:=wdGoToHeading,Which:=wdGoToFirst
转到下一个标题
Selection.GoTo What:=wdGoToHeading,Which:=wdGoToNext
检查您要去的地方,是否到达最后一个标题:
Check where you are to see if you have reached the last heading:
x=Selection.Start
Selection.GoTo What:=wdGoToHeading,Which:=wdGoToNext
if x = Selection.Start then '... last heading reachd
转到当前标题的末尾(例如,删除字符:
Goto end of current heading (for example, to delete chars:
Selection.EndKey Unit:=wdLine
这篇关于如何在MS Word中每个标题的末尾应用宏?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文