删除表前后的所有空格
我正在尝试删除 Word 文档中所有表格对象之前和之后的所有空格。
这是我到目前为止的代码:
With Selection.Find
.ClearFormatting
.Replacement.ClearFormatting
.Text = "^p^p"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
.Execute Replace:=wdReplaceAll
End With
这似乎删除了一些新的换行符,但不是全部。运行此宏后,当我单击“显示所有隐藏字符”时,它仍然显示一些 |P 标签。
I am trying to remove all the whitespace before and after all table objects in my word document.
This is the code I have so far:
With Selection.Find
.ClearFormatting
.Replacement.ClearFormatting
.Text = "^p^p"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
.Execute Replace:=wdReplaceAll
End With
This seems to delete some new line breaks but not all of them. After I have run this macro, when I click to Show all hidden characters it still shows some of the |P tags.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试更改
为
要找出要替换的字符,请选择文本并运行以下宏。
VBA 上的替换
在我的工作中使用过的
,它以这种方式完美工作,每个字符将始终由 ASC 代码[]表示
Try change
to
To find out which characters to replace, select your text and run the following macro.
Using replace on VBA
I've used in my work and it works perfectly this way, each character will always be represented by an ASC code
[]'s