How to access page breaks in VBA

Started by ImAPictureFormat, November 13, 2019, 04:42:56 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

ImAPictureFormat

Hi,

I have a tree structure that I've created using a custom stencil. As part of one of the features I'm working on, I've been looking for how to check where page breaks are in my VBA. I would have hoped that page breaks would have been part of the Visio.Page object, but to no avail.

Does anyone here know if/how page breaks are stored in an object I can access in my VBA? I don't want to modify the page breaks, I would just like to be able to check if a shape's location is past a page break; I'm also thinking of the case where there could be multiple page breaks across or down.

Thank you! :)

Surrogate

#1
Quote from: ImAPictureFormat on November 13, 2019, 04:42:56 PM
I would have hoped that page breaks would have been part of the Visio.Page object, but to no avail.
Since Visio 2010, page have default option - fit to their content size

ImAPictureFormat

Hi Surrogate,

Thanks for the response. I'm not 100% which option you're referring to, but I think you're talking about the "Fit to drawing" option. For what I'm working on, the diagrams will end up in a PDF where they'll be read by someone. So, my ultimate goal is to split up the tree cleanly so that 1) no blocks in tree overlap page breaks, and 2) the text that is going to be in the blocks of tree is legible without zooming in a lot. Because of this, I don't think fitting the page to the drawing will be what I need.

I will say though, that in lieu of being able to access the page breaks in some kind of object, I've just tried manually calculating where they are based on the page margins, drawing size, and page sizes. I'm thinking that might be the best I can do, unless someone else can provide something cleaner.

wapperdude

How are you creating the additional pages?  To go from one page to the next you need off-page connector. 

If you are using the page autosize functionality, well, that's a bit misleading.  That function changes the size of the active page.  While it looks like it's added a page, it hasn't.  This function, is tied to the Print functionality, and will print multiple pages as shown.  But, if you use VBA to get page count, page names, then, there's no "multiple" pages.  When PDF is generated, it will only the autosized page as a single page. 

Not aware of anyway to save these "pages" as individual, distinct pages.
Visio 2019 Pro