Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Unable to Draw Shape
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Unable to Draw Shape
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 "elziko" wrote: 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 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Unable to Draw Shape
Joel wrote:
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How can I rotate objects in draw without changing shape? | New Users to Excel | |||
If I draw a shape in Excel (say a triangle), can I colour it? | Excel Worksheet Functions | |||
How can you draw a shape when the values change each time?? | New Users to Excel | |||
draw shape based on cell values | Excel Programming | |||
can excel draw a shape based on values entered in cells | Excel Worksheet Functions |