Height of shape

O

ojv

m adding a number of shapes to a chart sheet using the using the the
Shape.Height property for relative positioning. The code I use work well with
Excel 2003 but fail utterly in Excel 2007 - always returning zero for height.
The shapes then appear on top of each other giving a rather cluttered
appearance. Any aid to why the height property returns zero in Excel 2007
would be greatly appreciated. Code snippet:

nextTop = 5
left = 5
For i = LBound(projectInfo, 2) To UBound(projectInfo, 2)
nextTop = nextTop + sh.height + 5
Set sh = chForStore.Shapes.AddTextbox(msoTextOrientationHorizontal,
left, nextTop, 0#, 0#)
Set sh = chForStore.Shapes(chForStore.Shapes.count)
With sh
.Select
Selection.AutoScaleFont = False
.TextFrame.Characters.Text = projectInfo(0, i) & " " &
projectInfo(1, i)
.TextFrame.Characters.Font.size = 10
.TextFrame.AutoSize = msoTrue
.Placement = xlFreeFloating
End With
Next
 
R

Rob van Gelder

I'm betting you haven't posted all of the code, because sh.height is referenced before sh is set!

nextTop = nextTop + sh.Height + 5
Set sh = chForStore.Shapes.AddTextbox(msoTextO ...

Cheers,
Rob
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top