Author Topic: Global variable list  (Read 4361 times)

0 Members and 1 Guest are viewing this topic.

Thomas Winkel

  • Full Member
  • ***
  • Posts: 228
Global variable list
« on: January 25, 2014, 11:48:23 PM »
Hi,

attached an example for a shape with a variable data field.
As new data is added to one shape it will directly be available via drop-down menu from the other shapes.

This is achieved by a User defined cell:
Code
=CALLTHIS("ThisDocument.AddName")+DEPENDSON(Prop.Name)

AddName() is very simple:
Code
Sub AddName(shp As Visio.Shape)
    ActiveDocument.DocumentSheet.Cells("Prop.Names").Formula = Chr(34) & shp.Cells("Prop.Name.Format").ResultStr(visNone) & Chr(34)
    shp.Cells("Prop.Name.Format").Formula = "=TheDoc!Prop.Names"
End Sub

The list is stored in a document property "Names".

Regards,
Thomas

Yacine

  • Hero Member
  • *****
  • Posts: 2923
Re: Global variable list
« Reply #1 on: January 26, 2014, 03:14:00 PM »
It's a very special case in which you would need your solution.
Usually, I'd just require the user to edit the list in the page's properties window.
but nicely done nevertheless.
Yacine

Thomas Winkel

  • Full Member
  • ***
  • Posts: 228
Re: Global variable list
« Reply #2 on: January 26, 2014, 05:31:39 PM »
Hi,

my use-case would be electric terminals in a schematic drawing (Name -> Signal).
But at the moment this is just an experiment for fun to test the DEPENDSON() function which I discovered a few days ago.
There are ways to destroy the global list. So probably I will never use this in my project.
Anyhow, its really fun to develop such little things in Visio, more than Excel VBA.

Btw. today I've read your comic strips. "This is because *crazy mathematics*"... So funny, thanks for sharing  ;D