Send shape to back via VBA

I'm using data in an Access database to create an excel spreadsheet that displays a series of timelines and activities (identified by various shapes) on those timelines (each timeline on a separate).  This works great.

But I'm also creating some labels (shapes) which contain text to accompany these shapes (code shown below).
Set shpLabel = xlSht.Shapes.AddTextbox(msoTextOrientationHorizontal, lngBoxLeft, lngBoxTop + 8, lngBoxRight - lngBoxLeft, 15)
    With shpLabel
        .TextEffect.Text = IIf(Milestone = "Event dates", "Main event", Milestone)
        .TextFrame.AutoSize = True
        .TextEffect.FontBold = msoTrue
        .TextEffect.FontSize = 10
    End With
        
    If shpLabel.Width > shpBox.Width Then
        shpLabel.Left = Int(shpBox.Left - (shpLabel.Width - shpBox.Width) / 2)
    Else
        shpLabel.Left = Int(shpBox.Left + (shpBox.Width - shpLabel.Width) / 2)
    End If

Open in new window


I know I'm going to kick myself for having to ask this, but I tried recording a macro to do this and nothing got recorded.  What method or property of the shape do I need to use to send it to the back.
LVL 50
Dale FyeAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

mbizupCommented:
Try this -
    shpLabel.select
    Selection.ShapeRange.ZOrder msoSendToBack

Open in new window

Similar issues with the Macro Recorder in Excel 2007 are metioned here:
http://www.mrexcel.com/forum/showthread.php?t=464037
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Dale FyeAuthor Commented:
It's Miriam, right?

Thanks.  Worked just like I wanted.  

I never would have figured out that particular combination of methods and properties.
0
mbizupCommented:
>> It's Miriam, right?

Yes!

I wouldn't have figured it out on my own either - it was a combination of the Macro Recorder in an older version of Excel and that link :-)

Odd that the recording doesn't work in 2007.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.