ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Freeform Object Failing (https://www.excelbanter.com/excel-programming/419658-freeform-object-failing.html)

egun

Freeform Object Failing
 
I am using VBA in Excel to draw freeform objects from arrays of data that are
supplied by the active worksheet:

With ActiveSheet.Shapes.BuildFreeform(msoEditingAuto, thePoly(1, 1),
thePoly(2, 1))
For i = 2 To NP
.AddNodes msoSegmentLine, msoEditingAuto, thePoly(1, i),
thePoly(2, i)
Next i
.ConvertToShape.Select
End With

Very simple. The problem is that every now and then the
".ConverToShape.Select" line fails with Run Time Error '1004', which doesn't
tell me much. I look at the points in the "thePoly" array, and they look
fine. Does anyone know what can cause this failure to occur?

Thanks,

Eric

Chip Pearson

Freeform Object Failing
 

I'd get rid of the Select method. Instead of

..ConvertToShape.Select

just use

..ConvertToShape

Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)

On Thu, 6 Nov 2008 14:19:01 -0800, egun
wrote:

I am using VBA in Excel to draw freeform objects from arrays of data that are
supplied by the active worksheet:

With ActiveSheet.Shapes.BuildFreeform(msoEditingAuto, thePoly(1, 1),
thePoly(2, 1))
For i = 2 To NP
.AddNodes msoSegmentLine, msoEditingAuto, thePoly(1, i),
thePoly(2, i)
Next i
.ConvertToShape.Select
End With

Very simple. The problem is that every now and then the
".ConverToShape.Select" line fails with Run Time Error '1004', which doesn't
tell me much. I look at the points in the "thePoly" array, and they look
fine. Does anyone know what can cause this failure to occur?

Thanks,

Eric



All times are GMT +1. The time now is 01:52 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com