Visio Guy

Visio Discussions => Programming & Code => Topic started by: lloydburton619 on October 17, 2014, 08:05:10 AM

Title: VBA code to select a shape that's in the same place on every page?
Post by: lloydburton619 on October 17, 2014, 08:05:10 AM
I have some code that generates a simple contents page for my Visio document based on the page names, however on each page I have a box with a unique number for each, located at the same location on each page; I want that number to appear in the contents page for each entry.

I think I can do everything apart from the bit that selects the box with the number in... how do I tell the code which box to select?

(New to VBA, have only learnt it through examples)

Thank you.
Title: Re: VBA code to select a shape that's in the same place on every page?
Post by: Yacine on October 17, 2014, 09:34:11 AM
Two possibilities:
1) you find a way to recognise the shape by some custom field or shape data, iterate through all the shapes of the page to find it, then do whatever you need with it.
2) instead of putting the unique number in a shape, put it in a custom property of the page. So retrieving this value would be easy (thepage!prop.uniqueNumber). Displaying this number would be as easy too, by inserting this value in the according shape.

HTH