Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How can I rotate objects in draw without changing shape? oldgunnersmate New Users to Excel 1 October 17th 08 07:21 PM
If I draw a shape in Excel (say a triangle), can I colour it? David Burne Jones Excel Worksheet Functions 4 August 4th 08 08:44 PM
How can you draw a shape when the values change each time?? man57 New Users to Excel 1 April 17th 06 09:30 AM
draw shape based on cell values Defoes Right Boot Excel Programming 5 February 10th 06 03:22 PM
can excel draw a shape based on values entered in cells Milo Excel Worksheet Functions 1 April 6th 05 01:36 AM


All times are GMT +1. The time now is 04:22 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"