Displaying MULTIPLE Custom Properties as Text on Visio Shape

G

Guest

Thanks to this newsgroup and to judicious GOOGLE use, I was able to
figure out how to use Insert => Field => Custom Formula to
automagically display text based on a Shape's Custom Property.

But I needed to display five (5) Custom Properties. After much
exprimenting (and cursing and Diet Coke) I think I stumbled on a
workable solution:

After creating my (Grouped) Shape,and ensuring assigned Custom
Properties were just right, I used the TextBox Tool to create five (5)
separate text boxes, sized, and positioned them over the Shape. I then
used the Custom Formula trick in EACH text box to point to the
appropriate Custom Property (i.e., Shape.1!Prop.xxxx). The value of
the Custom Propoerty appears as desired. Next I select the entire
group of objects using the Select Tool and drawing a rectagle which
includes the undereslying Shape and the five (5) defined text boxes, I
drag it to the Stencil to create a new "Master".

(I found that if I tried to UNGROUP my shape, add the text boxes,
then re-GROUP everything, the shape's Custom Properties were
eliminated when I performed the UNGROUP, so there was nothing I could
use in the Custom Formula....)

I think I understand the importance of assigning the Custom Properties
to the Shape; when I reGROUP everything and drag it to the Stencil,
it seems to do the trick.

From then on, I can drag & drop the newly created Master, and the
Custom Properties pop-up as expected (according to the "Ask" and
"Hidden" property selections). And the Cusom Properties do appear to
apply to the instanced shape on the drawing (based on Property Sheet
inspection).

So everyhting is working as I wanted - AND IT SCARES ME! I feel like
I am missing something fundamental and want to check this approach
before I use these stencils (I created several in the same manner) in
dozens of drawings. I don't want to find out down the line that this
was a stupid approach (even though it *seems* to work. As Jim Carey
shouted in "The Mask": "SOMEBODY STOP ME!"

I am darned lousy (dangerous,really) with VBA, so I was searchhing for
a solution using the standard interface elements without having to
learn VBA and the Visio object model. (I have experience dabbling in
Outlook's object model and VBA environment - and it is a very
frighteneing place to be....)

Thanks for any critical analysis of the above method! (In other
words, flames are OK - I can take it as long as I get a workable
solution out of this!)

/Cal/

cal*AT*oakharbor.net <--change the obvious....
 
M

Mark Nelson [MS]

There is nothing wrong with your approach, but I wonder if there is a
simpler way to accomplish your goal.

You can have multiple fields in shape text, so it is possible for a single
shape to show all the custom properties. Select your shape that has the 5
custom properties. Then hit F2 to enter text entry mode. Now choose Insert
Field and add your first property. This will return you to text entry
mode. Now type in any spacer or separator characters you like and choose
Insert > Field again to add your next property. You can continue to mix
text and fields together until you exit text entry mode by using Esc or
clicking outside the shape.
 
G

Guest

Thank you, Mark. That certainly DOES sound easier and more
straightforward. I will try it out as soon as possible. Is that
approach documented anywhere? I dug & dug through Help, Developer
Help, "Developing MS Visio Solutions", and other references.

/Cal/
cal*AT*oakharbor.net <--change the obvious....
 
G

Guest

It works just dandy and will greatly extend the life of my mouse's
left-click microswitch! Thanks again, Mark.

/Cal/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top