select specific stencil based on value in a column from datarecord

Started by Ofreyes2, May 06, 2018, 05:47:18 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Ofreyes2

Hello,
I Would like some help. I would like to be able to look thru the linked data set and choose a column and go thru each row and if it meets a specific value then i want to use one type of stencil and if it meets another value to use a different stencil. at the moment i have VBA that drops stencils of one type with the correct linked data. i would like to be able to have an If statement but i cant figure out how to point to the linked data recordset and go thru each row in the specific column.

Yacine

If you do the droping job with VBA already, it shouldn't be difficult to drop the right master (record a macro and look for the commands used).
If you're looking for something that can be modified after the dropping you may consider a shape that replaces its subshapes depending on its properties: http://visguy.com/vgforum/index.php?topic=6195.0
Yacine

Ofreyes2

Thank you for the Response, I started with recording macro i dropped for different shapes and then i used FOR NEXT and it DROPPED all 4 shapes the amount of times i inputted then I removed the other 3 items and then it put all the same stencil the 29 times now I would like it to make the choice from column 6 if it is empty to use this stencil if its not empy use that stencil, i just cant figure out how to make the vba IF THEN statement by referring to my linked data record set column 6 rows. unfortunately the record Macro doesnt tell me that part. ive been looking around for a sample code and have not been able to find it.

Yacine

That's right, Visio won't tell you to pick up data from a certain culumn, but it will assign the value of this column to a custom property in your shape. That's the variable you're looking for.

Say you linked "Column_6" to "prop.Six". Let Visio do the update job, then in VBA, you'd say:
myVal = shp.cells("prop.Six").resultstr("")
if myVal = ... then
    ...
endif
Yacine