Unable to Draw Shape

E

elziko

In my application I am unable to draw certain shapes - in the end it seems
that the points themselves seem to be the problem.

To test this I created a blank Chart sheet and recorded a macro of me
drawing a successful freehand shape - any shape. I then replaced the macro
code with my own points so the code looks like this:

With ActiveChart.Shapes.BuildFreeform(msoEditingAuto, 429.95, 74.9295)
.AddNodes msoSegmentLine, msoEditingAuto, 433.9, 78.33801
.AddNodes msoSegmentLine, msoEditingAuto, 461.55, 119.24
.AddNodes msoSegmentLine, msoEditingAuto, 457.6, 123.0495
.AddNodes msoSegmentLine, msoEditingAuto, 437.85, 118.839
.AddNodes msoSegmentLine, msoEditingAuto, 418.1, 109.4155
.AddNodes msoSegmentLine, msoEditingAuto, 382.55, 92.37298
.AddNodes msoSegmentLine, msoEditingAuto, 422.05, 75.73148
.AddNodes msoSegmentLine, msoEditingAuto, 429.95, 74.9295
.ConvertToShape.Select
End With

If I then run this macro I get "Run-time error '1004': Application defined
or object-defiend error".

I get this in Excel 2000 and Excel XP. It get drawn OK in Excel 2007 and I
haven;t tested it in Excel 2003.

Can anyone shed any light on why I would not be able to draw this shape?

TIA
 
G

Guest

I cheated. used VBA help for buildfreeform and used the eexample tto fix
your problem

Set myDocument = Worksheets(1)
With myDocument.Shapes.BuildFreeform(msoEditingAuto, 429.95, 74.9295)
.AddNodes msoSegmentLine, msoEditingAuto, 433.9, 78.33801
.AddNodes msoSegmentLine, msoEditingAuto, 461.55, 119.24
.AddNodes msoSegmentLine, msoEditingAuto, 457.6, 123.0495
.AddNodes msoSegmentLine, msoEditingAuto, 437.85, 118.839
.AddNodes msoSegmentLine, msoEditingAuto, 418.1, 109.4155
.AddNodes msoSegmentLine, msoEditingAuto, 382.55, 92.37298
.AddNodes msoSegmentLine, msoEditingAuto, 422.05, 75.73148
.AddNodes msoSegmentLine, msoEditingAuto, 429.95, 74.9295
.ConvertToShape.Select
End With
 
E

elziko

Joel said:
I cheated. used VBA help for buildfreeform and used the eexample tto
fix your problem

Thanks for the reply. I still get the same error... did you confirm that my
code wasn't working and then that your code fixed the problem? If so what
error message were you initially getting and what version of Excel do you
have?

TIA
 
Top