Word VBA 中的分节符

发布于 2024-08-06 09:08:20 字数 145 浏览 1 评论 0原文

如何检测您的选择是否包含分节符?

现在我选择一个页面,折叠到最后,我想知道页面末尾是否包含分节符。

我打算使用一种方法,比较页面末尾的节号,然后向前移动两个字符,然后检查节号。如果它们不同,那么我的页面末尾确实有一个分节符 - 有更好的方法吗?

How can you detect if the selection you have contains or is the section break character?

At the moment I select a page , collapse to the end , I want to know if the end of the page contains a section break or not.

I was going to use a method where I compare the section number at the end of the page , then move two characters forward , then check the section number. If they are different then the end of my page does have a section break - is there a better way to do it?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

只是一片海 2024-08-13 09:08:20

也许是这样的:

Function HasBreak() As Boolean

With Selection.Find
    .Forward = True
    .Execute FindText:="^b"

    If .Found Then
        HasBreak = True
    End If
End With

End Function

Perhaps something on these lines:

Function HasBreak() As Boolean

With Selection.Find
    .Forward = True
    .Execute FindText:="^b"

    If .Found Then
        HasBreak = True
    End If
End With

End Function
猫性小仙女 2024-08-13 09:08:20

干杯这是一个很好的建议。

我最终的做法是获取页面和部分的范围,检查两个“结束”位置,如果它们相同,则页面包含分节符。

Cheers that's a good suggestion.

The way I did it in the end was get the range of the page and section , check both "End" positions , if they were the same then the page contained the section break.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文