Visio Guy

Visio Discussions => ShapeSheet & Smart Shapes => Topic started by: Budgie on July 20, 2016, 05:49:16 AM

Title: Change shape fill and text parameters based on another shapes data variables
Post by: Budgie on July 20, 2016, 05:49:16 AM
Guys,
I've done some searching and found a few articles discussing the kind off thing I want to do but have so far not found the short answer.

I have a set of standard shapes for a process I use and I'd like to simply and quickly define the fill colour and customer name for the entire visio file and then have all my shapes updated to reflect that.  I was thinking of using a master shape, lets call it "input shape" and it's shape data to achieve this as follows but can't make it work.

I have standard shapes (which are spread across different sheets/pages in the same visio file) which have a 'fill colour' and 'text' displaying the customers name.  What I want to achieve is via another "Input shape" and using this shapes shape data enter a 'customer name' and 'colour' (I assume in hex values?) and when I do the fill colour and text displayed in all my other shapes are updated to the values specified. 


If there's a better way to achieve this I'm all ears

Note I'm using Visio 2016

Cheers Tony
Title: Re: Change shape fill and text parameters based on another shapes data variables
Post by: JuneTheSecond on July 20, 2016, 10:59:53 AM
How would you like SetAtRef function?
Title: Re: Change shape fill and text parameters based on another shapes data variables
Post by: Hey Ken on July 20, 2016, 12:57:49 PM

Budgie:

   I do that all the time for font and font size in my drawings, and the technique is directly transferrable to what you're trying to do.  What you call an "input shape" I call a "hot shape", because whatever font and font size I put there is automatically replicated everywhere.  Best of all, it doesn't need any VBA to work.  Check out something I posted here several years ago: http://visguy.com/vgforum/index.php?topic=4555.msg17819#msg17819 (http://visguy.com/vgforum/index.php?topic=4555.msg17819#msg17819).  Where I use Char.Size, you can use FillForegnd, but the text part is a bit more complicated.  You'll need to insert a text field with a custom formula that points to the text of your hot shape, something like TheDoc!User.CustomerName which your hot shape can initialize via its TheText event.

   Good luck!

   - Ken


Title: Re: Change shape fill and text parameters based on another shapes data variables
Post by: Budgie on July 25, 2016, 07:54:02 AM
Thanks guys, I managed to get this working via the SetAtRef function for both text and the shape colour (FillForegnd)

Cheers Tony