Auto Change color of line

Started by Speedkiller1975, October 27, 2016, 08:01:34 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.



I'm new with Visio but i made already shapes that can change from shape and use shapedata sheet.

My problem is i making logic symbols. I like to change the color of the line in red if signal is 1 and black if 0.

I like to let persons that ar not good with Visio to use it. That the user don't have to change things in shapedata sheet.

now is the formule i use in line shapesheet -> Line Format -> LineColor

IF(Multi Logic.57!Prop.Input_1=1,2,0)

This is working correct.

my problem is 3
"Multi Logic" is a variable
".57" is a variable
"Prop.Input_1" is a variable

If i select the the this with shape data.

Prop.Input = can be Prop.Input_1 or Prop.Input_2 ect. (1 (Type list fix))
Prop.Type_symbol = can be Multi Logic or NOT ect. (1 (Type list fix))
Prop.Number_symbol = " a number the user gives" (2 (Type Number))

if i than use

I get the value 0 always.

if I change the 1 to Multi Logic.57!Prop.Input_1 i get a 2.

is there a way to use the variable value in a formule.

i wish it can be done in the shapedata sheet.

If it is in VBA it is also good. Only I'm not know how to get the data from "Prop.Input, Prop.Type_symbol,Prop.Number_symbol" and to put it back in the right cell.

If i use EXcel vba than this works.

Cell1 = "C4"
Cell2 = "C5"
Formule = "="
Formule = Formule + Cell1
Formule = Formule + "+"
Formule = Formule + Cell2

Range("C6").Formula = Formule

a picture of how it looks


Basically lots of ways to do this

here is an esay way to read (basically you can nest up to 127 if thens in a formula...also, liberally use cells, easier debug)

user.test = if(input = 1 & multi=1,1,if(input = 0 & multi=1,2,if(input=1 & multi=0,3,4)))

Line color = if(if user.test=1, RGB(a,b,c),if (user.test=2, RGB(x,y,z), if (user.test=3,RGB(l,m,n), RGB (r,s,t))))

Once you understand this...can use tighter formulas and more advanced functions like lookup to compact down
(this example allows you to debug the logic - see user.test discretely  by viewing values then see what linecolor did)


Halo Vojo

That i know only the Prop.Number_symbol (blue) can be any number Visio gives from 1 to 140 so a formul will not work.


Hi Speedkiller1975,

I'm on vacation this week but I can post a sample drawing with more functions next week. I made a similar logic template for my team as well so I'm familiar with these kind of applications


oh...if you don't know the source shape name apriori, then need VBA  (no shape "discovery" in shapesheet)
As far as color goes....its explicit...not some value between 1 and 40 and you got to guess what it is.
If its themes you are worried about, may need to normalize the fixed value you pick...or...use RGB or HSU
Visio wont just randomly pick a color value


Hi Vojo and metuemre

I will appreciate metuemre.


The color i know what it needs to be. The difficulty is that the shape is not know.

but thanks i thought so that it needs to be don in VBA.

do i need to repost it in the VBA section.