#1   Report Post  
Herbert Seidenberg
 
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?

  #2   Report Post  
Andy Pope
 
Posts: n/a
Default

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
  #3   Report Post  
Herbert Seidenberg
 
Posts: n/a
Default

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

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
Error trapped only while stepping through the code - Not triggered when run Jeff Excel Discussion (Misc queries) 7 March 7th 05 06:29 PM
Error trapped only while stepping through the code - Not triggered when run Jeff Excel Discussion (Misc queries) 0 February 28th 05 06:26 PM
Problem with VBA returning the contents of a long formula. [email protected] Excel Discussion (Misc queries) 2 February 23rd 05 12:14 AM
ERROR Pinto1uk Excel Discussion (Misc queries) 1 February 8th 05 03:15 AM
Run-Time Error: You must select a shape Lee Excel Worksheet Functions 1 January 25th 05 05:31 PM


All times are GMT +1. The time now is 11:24 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"