Re: FillForegnd syntax error - bad fraction - with HSL reference

Ola Ricardo,

Works fine for me. And since you're using 2003, there shouldn't be any
"non-US" problems like list separators or localized cell/formula names.

Are you sure you have the right shape object, for example a sub-shape
instead of a group. Does the shape have any locked attributes? Like locked
layers or cells in the protection section? Of course = 16 does work for you,
so this wouldn't make a lot of sense.

Might try this as well:

objShape.CellsU("FillForegnd").FormulaForceU = "HSL("144, 116, 225)"

Sorry I can't give you anything definite!

Hope this helps,

Chris Roth
Visio MVP

More Visio shapes, articles, development info and pure diagramming fun at:

"Ricardo Dias Marques" <Ricardo Dias Marques@xxxxxxxxxxxxxxxxxxxxxxxxx>
wrote in message news:9A702DE6-B244-4510-9BD3-BB2039E2E557@xxxxxxxxxxxxxxxx
Hi all,

I am using Visio Professional 2003 SP1 (in Windows XP Professional).

I'm writing a VBA Macro that (among other things) sets the Fill Foreground
of a shape.

Everything works well if I write my statement like this (16 = the color
objShape.Cells("Fillforegnd") = 16

... But I'm having problems when trying to set the value to an HSL (Hue,
Saturation, Lightness) reference.

I have tried writing:
objShape.Cells("FillForegnd").Formula = "HSL(144, 116, 225)"

... but that returns an error message:
" Run-Time error '-2032466667 (86db0515)':
Syntax error: bad fraction."

I get the same error if I add an "equal sign" before "HSL":
objShape.Cells("FillForegnd").Formula = "=HSL(144, 116, 225)"

The numbers (144, 116, 225) should be correct (I'm copying them from the
FillForegnd cell of the "Fill Format" section from the ShapeSheet of

Could anyone tell me what I'm doing wrong, please?

Thanks in advance!

Best wishes,
Ricardo Dias Marques
newsgroup DOT poster AT hotmail DOT com