Filling between lines

M

mjuter

Hi there

I am trying to created a shape from 2 arcs and 2 lines, add some text,
rotate and reposition it, within VBA.

The problem seems to be with a colour fill, as I have managed to
complete all the above.

Adding text, rotating and positioning have been achieved by grouping
and using:

ShapeGroup.Text = ttt
ShapeGroup.Cells("PinX") = xxx
ShapeGroup.Cells("PinY") = yyy
ShapeGroup.Cells("Angle") = aaa

Applying a fill colour seems to be impossible in VBA (I have managed
to manually fill it by joining prior to changing the colour, but the
recorded macro has as ItemFromID(?) component and I am unable to find
the ID in the properties!)

Does anybody out the have any ideas how I should proceed?

Many thanks

Mark
 
J

John... Visio MVP

Hi there

I am trying to created a shape from 2 arcs and 2 lines, add some text,
rotate and reposition it, within VBA.

The problem seems to be with a colour fill, as I have managed to
complete all the above.

Adding text, rotating and positioning have been achieved by grouping
and using:

ShapeGroup.Text = ttt
ShapeGroup.Cells("PinX") = xxx
ShapeGroup.Cells("PinY") = yyy
ShapeGroup.Cells("Angle") = aaa

Applying a fill colour seems to be impossible in VBA (I have managed
to manually fill it by joining prior to changing the colour, but the
recorded macro has as ItemFromID(?) component and I am unable to find
the ID in the properties!)

Does anybody out the have any ideas how I should proceed?

Many thanks

Mark

The ItemFromID can be ignored.
If you had Shapes.ItemFromID(2), you can use Shapes(2).

For filling, you have to make sure the shape is closed.

John... Visio MVP
 
M

mjuter

The ItemFromID can be ignored.
If you had Shapes.ItemFromID(2), you can use Shapes(2).

For filling, you have to make sure the shape is closed.

John... Visio MVP- Hide quoted text -

- Show quoted text -

Hi John

Thanks for the reply, my problem seems to be around not being able to
access the Shape index (2 in your example), I get "object doesn't
support this method or property" error message for shape.ID and other
things I try.

The "join" should close the shape. As I created the shape from lines,
most of the properties in the watch window have a value of "an
exception occured", which seems to be the root of my problem, and I
am not sure how I can solve this?

Cheers

Mark
 
M

mjuter

Hi John

Thanks for the reply, my problem seems to be around not being able to
access the Shape index (2 in your example), I get "object doesn't
support this method or property" error message for shape.ID and other
things I try.

The "join" should close the shape. As I created the shape fromlines,
most of the properties in the watch window have a value of "an
exception occured",  which seems to be the root of my problem, and I
am not sure how I can solve this?

Cheers

Mark- Hide quoted text -

- Show quoted text -

Thought I would update this post as I solved my problems the solution
involved

1) Draw shape from lines
2) Join the shape together
Application.ActiveWindow.Selection.Join

3) Use the fact that shapes are added to the shape list in order of
creation (some thing that I had forgotten)
ShapeID = ActivePage.Shapes.Count

4) Colour the shape
ActivePage.Shapes(ShapeID).CellsSRC(visSectionObject, visRowFill,
visFillForegnd).FormulaU = "RGB(117,221,117)"

5) Set the fill pattern so the colour is visible
ActivePage.Shapes(ShapeID).CellsSRC(visSectionObject, visRowFill,
visFillPattern).FormulaU = "1"

Cheers

Mark
 

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