Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 162
Default Bug? AutoShape position properties incorrect

I have a function that iterates through the Shapes collection as
follows:

For Each shp In ActiveSheet.Shapes ' shp is Dim'ed as Shape
t = shp.Top
b = t + shp.Height
l = shp.Left
r = l + shp.Width
Debug.Print shp.Name, t, b, l, r
' do some other stuff
Next

The function wasn't working correctly, so I added the Debug.Print to
examine the values, and they were all wrong! The Debug.Print output
was:

'shp.Name, t, b, l, r:
AutoShape 1 4.08 8.16 4.08 16.32
AutoShape 2 12.24 16.32 4.08 16.32
AutoShape 4 20.4 24.48 4.08 16.32
.... etc.

Next I added a breakpoint to step through it. When I did, the
coordinates were suddenly correct. ?!? So I ran it again with the
breakpoint on the "t = shp.Top" line, toggled the breakpoint off, then
ran it to completion. The Debug.Print output now was:

'shp.Name, t, b, l, r:
AutoShape 1 25.5 51 25.5 102
AutoShape 2 76.5 102 25.5 102
AutoShape 4 127.5 153 25.5 102
.... etc.

These values are all 6.25x the first set. I hadn't changed any of the
shapes on the sheet, and the code in the for-loop does not alter them
in any way. It just reads a few properties.

So it seems that if I give Excel a moment to "catch it's breathe", the
coordinates all get resolved correctly.

Anyone have any clue as to what might be causing this?


Thanks,

Nick Hebb

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
Changing Autoshape properties using formulas only Chris Excel Discussion (Misc queries) 0 September 7th 08 08:07 AM
Position of CellCursor on Screen (absolute position) [email protected] Excel Programming 1 November 23rd 05 02:23 AM
Properties transferring from excel cells to word file properties lubo Excel Programming 4 July 12th 05 11:24 AM
AUTOSHAPE Glenn Excel Programming 4 May 12th 05 02:43 AM
autoshape scrabtree[_2_] Excel Programming 1 August 13th 04 01:36 PM


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