FillForegnd syntax error - bad fraction - with HSL reference

  • Thread starter Ricardo Dias Marques
  • Start date
R

Ricardo Dias Marques

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 gray):
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 another
shape).

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
 
C

Chris Roth [MVP]

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:
www.wanderkind.com/visio
 
P

Paul Herber

On Tue, 19 Sep 2006 04:26:02 -0700, Ricardo Dias Marques <Ricardo Dias
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 gray):
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)"

try
objShape.Cells("FillForegnd").FormulaU = "HSL(144, 116, 225)"

it may be a localisation issue
 
R

Ricardo Dias Marques

Olá (Hi) Chris! :)

:

[snip]
Might try this as well:

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

Great! Using "FormulaForceU" instead of "Formula" solved the problem.


Paul Herber's solution (using "FormulaU" instead of "Formula") also worked :
try
objShape.Cells("FillForegnd").FormulaU = "HSL(144, 116, 225)"
it may be a localisation issue

I'm in Portugal, but my Windows and Visio are both the English versions. But
seeing that using "FormulaU" or "FormulaForceU" solved the problem, it seems
this was indeed some kind of localisation issue.

So, thanks a lot Chris Roth & Paul Herber! :)

Ricardo Dias Marques
newsgroup DOT poster AT hotmail DOT com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top