PC Review Forums Newsgroups Microsoft Excel Microsoft Excel Charting Shape error

Reply

Shape error

 
Thread Tools Rate Thread
Old 21-05-2005, 06:12 AM   #1
Herbert Seidenberg
Guest
 
Posts: n/a
Default Shape error


Here is a modified version of Andy Pope's Line_Direction.xls VBA
program at
http://www.andypope.info/ngs/ng10.htm
Sub pointer()
Dim angle As Integer
Dim Start As Double
Dim ArrowHead As Shape
Set ArrowHead = Sheets("data").Shapes("arrow2")
For angle = 0 To 180 Step 10
With ArrowHead
.LockAspectRatio = msoFalse
.Left = 72
.Top = 210
.Rotation = angle
.Height = 0.3 * (angle + 50)
.Width = 0.3 * (1.5 * (angle + 50))
.Copy
End With
'Sheets("chart1").SeriesCollection("track").Points(10).Paste
Start = Timer
Do While Timer < Start + 0.2
Loop
Next angle
End Sub

It works as expected, but when I uncomment the Sheets...Paste line,
I get the error message:
Method 'Height' of object 'Shape' failed.
If I comment out Height/Width, ...Paste works as expected.
How can I get Height/Width and Paste to work together?

  Reply With Quote
Old 21-05-2005, 12:51 PM   #2
Andy Pope
Guest
 
Posts: n/a
Default Re: Shape error

Hi Herbert,

I can't recreate you problem so can you email your workbook and I will
have a look.

Cheers
Andy

Herbert Seidenberg wrote:
> Here is a modified version of Andy Pope's Line_Direction.xls VBA
> program at
> http://www.andypope.info/ngs/ng10.htm
> Sub pointer()
> Dim angle As Integer
> Dim Start As Double
> Dim ArrowHead As Shape
> Set ArrowHead = Sheets("data").Shapes("arrow2")
> For angle = 0 To 180 Step 10
> With ArrowHead
> .LockAspectRatio = msoFalse
> .Left = 72
> .Top = 210
> .Rotation = angle
> .Height = 0.3 * (angle + 50)
> .Width = 0.3 * (1.5 * (angle + 50))
> .Copy
> End With
> 'Sheets("chart1").SeriesCollection("track").Points(10).Paste
> Start = Timer
> Do While Timer < Start + 0.2
> Loop
> Next angle
> End Sub
>
> It works as expected, but when I uncomment the Sheets...Paste line,
> I get the error message:
> Method 'Height' of object 'Shape' failed.
> If I comment out Height/Width, ...Paste works as expected.
> How can I get Height/Width and Paste to work together?
>


--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info
  Reply With Quote
Old 22-05-2005, 07:56 PM   #3
Herbert Seidenberg
Guest
 
Posts: n/a
Default Re: Shape error

Thanks Andy,
Copying from the chart to the point worked much better than copying
from the worksheet to the point.
Herb

  Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off