excel 2007 vba:如何引用HPageBreaks

发布于 2024-08-26 20:34:15 字数 217 浏览 12 评论 0原文

我正在尝试编写一个宏,它可以查看工作表保留的水平分页符列表,看起来 HPageBreaks 应该正是这样。我可以添加或删除分页符,但我似乎无法隔离集合本身来查看其内容。即使添加监视并查看 ActiveSheet.HPageBreaks,也只会显示一个计数字段等于 0 的通用对象,而不管现有分页符如何。

我现在对此真的很困惑。有什么方法可以查看工作表中现有的分页符吗?列出它们出现在哪些行上/之间会很棒。

I'm trying to write a macro which can look into the list of horizontal page breaks that a worksheet keeps, and it seems like HPageBreaks should be exactly that. I can add or remove page breaks from it, but I can't seem to isolate the collection itself to look at its contents. Even adding a watch and looking at ActiveSheet.HPageBreaks just brings up a generic looking object with a count field equal to 0 regardless of existing page breaks.

I'm really confused about this now. Is there any way to look into the existing page breaks within a sheet? A listing of what rows they occur on/between would be great.

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

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

发布评论

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

评论(1

冷清清 2024-09-02 20:34:16

这应该可以帮助您开始:

Sub testing()
    MsgBox "There are " & ActiveSheet.HPageBreaks.Count & " pagebreaks."
    For Each pb In ActiveSheet.HPageBreaks
        MsgBox "a page break lies between rows " & pb.Location.Row - 1 _
            & " and " & pb.Location.Row
    Next
End Sub

这里有一些(相当少的)参考:

http://msdn.microsoft.com/en-us/library/aa661442(office.10).aspx

http://msdn.microsoft.com/en-us/library/aa206426(office.10).aspx

This should get you started:

Sub testing()
    MsgBox "There are " & ActiveSheet.HPageBreaks.Count & " pagebreaks."
    For Each pb In ActiveSheet.HPageBreaks
        MsgBox "a page break lies between rows " & pb.Location.Row - 1 _
            & " and " & pb.Location.Row
    Next
End Sub

Here are some (rather scanty) references.:

http://msdn.microsoft.com/en-us/library/aa661442(office.10).aspx

http://msdn.microsoft.com/en-us/library/aa206426(office.10).aspx

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