Odd benaviour when linking Visio to Excel

Started by miless2111s, October 27, 2011, 08:54:36 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

miless2111s

Hopefully there's just someting that I'm missing which is really simple....

I have linked about 3-400 shapes to excel so that their position, colour and size is controlled by the values in the excel sheet.

I want to be able to control their angle of rotation as well however when I put 45 deg into the Angle column it doesn't seem to "take" in that the angle of the shape does not change.  Baisc numbers (including all the XX mm values) seem to go across fine however I have noticed that complex RGB codes etc don't seem to take either.

I'm not to worried about the colours one (though it would be nice) however I am getting frustrated that I can't make the angle work.  Is there something silly or some trick that I'm missing?

Many thanks

Miles
PS this is with Vision 2003 and Excel 2003 on XP (with latest SP)

Jumpy

Maybe recalc deg to rad and store the rad value in Excel (without giving it a unit (like deg), just the number)?

miless2111s

You are a genius! :) ;D 8)

Why does that work I wonder?

Can something equally clever be used to access fill colours which are not simple 1-20 etc?

Miles

Jumpy

From here: http://msdn.microsoft.com/en-us/library/ff769052.aspx

Quote
Returns a value representing an index in the document's color palette. It specifies a color by its red, green, and blue components, where each is a number in the range 0 to 255, inclusive, or an expression that evaluates to such a number.
[...]
If the color returned by the function does not already exist in the current document's color palette, it is added to the palette.

I guess the last part is the problem, even if you could see and store the numerical value that is the result of the RGB-funtion.

A workarround could be to store the R,G,B values in separate colors in Excel. Link them to user defined cells in the shapesheet (User.R, User.G, User.B) and place a formula in the FillColor cell: =RGB(User.R,User.B,User.G)

aledlund

#4
"Internally, Visio uses inches for measuring distance, radians for measuring angles, and days for measuring durations."
from
http://msdn.microsoft.com/en-us/library/aa200961(v=office.10).aspx#573

also found this of interest over on John Goldsmith's blog

http://visualsignals.typepad.co.uk/vislog/2011/09/using-excel-to-build-visio-shapesheet-formulae.html

al


miless2111s

When I had a look at Goldsmith's article I was rather confused by the length and complexity of the colour entries - what's going on there?
Miles

JohnGoldsmith

Hello Miles,

Sorry you found the article confusing, although maybe my scenario didn't help make the process clear :)

The problem I was trying to deal with is that of long strings which inevitably lead to typos/bugs.  The shapes I'm dealing with (jQuery Mobile for this post http://visualsignals.typepad.co.uk/vislog/2011/08/visio-shapes-for-jquery-mobile.html ) support five generic themes and a large colour palette.  For each given colour the resulting value could be one of five depending on the theme selected - hence each user cell is an indexed list of RGB formulae. 

Rather than add the colour directly to the shapes I decided to add them to the document shapesheet so that there would be a single place to change them if required.

I've found it easier to use Excel to generate and manipulate the formulae strings and then either copy and paste or write code to plug them back into the shapesheet.  If you know that something like this is going to change in the future then it makes sense (to me) to build in some flexibility from the start.

Regarding your RGB problem @Jumpy has a good solution.  Also are you trying to link the whole formula [ie 'RGB(0, 255,0)'] or just the values [ie '0, 255, 0']?  My guess is that it's being treated as a string and not a proper shapesheet function.  Can you share respective shapesheet formulae and the results you're getting?

Best regards

John
John Goldsmith - Visio MVP
http://visualsignals.typepad.co.uk/