ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Trouble positioning an autoshape object using .Top in Excel 2007 (https://www.excelbanter.com/excel-programming/412680-trouble-positioning-autoshape-object-using-top-excel-2007-a.html)

Michael

Trouble positioning an autoshape object using .Top in Excel 2007
 
I wrote a macro in Excel 2003 that places an Autoshape objects at the top of
each row and then moves on to the next row. This has worked fine in 2003 but
our office is slowly migrating to 2007 and the template is having problems.

When the same macro is run using Excel 2007, line by line, the objects
appear to creap high and higher in the row to the point where they start
looking to be start in the row above them. Has something changed in Excel
2007 that would prevent this 2003 functionality from working in 2007?

Sample Code:
Do While bGenericContinue = True
nProjectedBarLeft = 135
nProjectedBarTop = Cells(iTgtRowNum, 1).Top
nProjectedBarWidth = 245
nBarHeight = Cells(iTgtRowNum, 1).Height
ActiveSheet.Shapes.AddShape(msoShapeRoundedRectang le,
nProjectedBarLeft, nProjectedBarTop, nProjectedBarWidth, nBarHeight).Select
iTgtRowNum = iTgtRowNum + 1
If iTgtRowNum = 25 Then
bGenericContinue = False
End If
Loop




All times are GMT +1. The time now is 07:32 PM.

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