Microsoft Word: How to move overlapping frames to fore- or background

Posted on 2011-10-07
Last Modified: 2012-05-12
Hi Word Experts,

I have a Word 2003 document (I have tried the following in both Word 2003 and 2010) that contains two frames (to bundle and arrange text blocks). One frame is smaller and fully behind the other frame. When I now want to click on the smaller frame to edit the text, I always select the larger frame that sits on top of the smaller one.

How can I arrange the two frames so that the smaller one comes to the foreground?

Before you post a comment please note that I'm not talking about textboxes or graphic boxes that can be sent behind other objects. I'm talking about text frames. (see Microsoft's definition of frame)

Thank you and best regards,

Question by:Staudte
    LVL 76

    Accepted Solution

    I don't think that there is any easy way of doing that, even in VBA code.

    There is no programmatic method that I can find for discovering or setting the zOrder. Nor is it possible to make the background transparent. There is a method to convert a Textbox to a Frame, but not the other way round, probably because the Frame methods were designed before the Textbox was designed.

    I have explored the possibility programmatically deleting the frames and re-adding them in a particular order, assuming that the last added would cover the first, but that is more complicated than I expected

    As you might know, Microsoft have been reducing the support for frames. There is no mention in the 2007 ribbon. Can you consider using textboxes instead?

    Author Closing Comment

    Hi Graham,

    thanks for having a look at that problem. I was afraid that there is not way to change the zorder of frames. Why in one document they are stacked in one way in in a nother document they are stack the oher way will most likely remain a mystery...

    And, yes, I can switch to textboxes - it's an aweful work (roughly two dozen documents need to be changed), but what helps...

    LVL 76

    Expert Comment

    If you do intend to switch to textboxes, you might like to try this macro. It isn't perfect, but I don't know how precise you need the positions to be.
    Sub ConvertToTextBoxes()
        Dim fr As Frame
        Dim rng As Range
        Dim brd As Border
        Dim sh As Shape
        Dim f As Integer
        Dim l As Single, t As Single, h As Single, w As Single
        Do While ActiveDocument.Frames.Count > 0
            With ActiveDocument.Frames(1)
                l = .HorizontalPosition
                t = .VerticalPosition
                h = .Height
                w = .Width
                Set rng = .Range
                Set sh = ActiveDocument.Shapes.AddTextbox(msoTextOrientationHorizontal, l, t, w, h, rng)
                For Each brd In rng.Paragraphs.First.Borders
                    brd.LineStyle = wdLineStyleNone
                Next brd
            End With
    End Sub

    Open in new window


    Author Comment

    Hi Graham,

    thanks a lot for this cool macro - it'll save me quite a bit of work. If anyone ever reads this again: The macro has a problem in line 18 when width or heigt of the frame were set to automatic (h or w = -1), which will fail when the textbox is created. Also, the positioning of the textboxes does not maintain the fixpoint, i.e. if the frame was relative to page, margin, etc. Also, borders are set for the textboxes, while the frames had no borders.

    Graham, you don't need to fix this for me - it helps me the way it is, because it does convert the relevant frames and shifting them to the right position on the page is done by a flick of the mouse. I'm noting this only as a hint for anyone who might read this in the future.

    Thanks again!
    LVL 76

    Expert Comment

    Hi Thomas,

    Thanks for the information. I'm glad that you find it useful. Perhaps I'll improve it if another question is posted sometime in the future.

    Featured Post

    Do You Know the 4 Main Threat Actor Types?

    Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

    Join & Write a Comment

    Introduction Authors who set out to write any sort of lengthy piece for online submission—be it a long question or comment on a technical form, an article, or a substantial blog entry—often find it useful to work up a draft in an editor other t…
    This article describes how to use the Send to Mail Recipient command. The instructions apply generally to Office 2007 and later versions, but Microsoft® Word 2013 was used for the specific steps and figures.  What is Send to Mail Recipient? Send…
    This video shows and describes the main difference between both orientations in Microsoft Word. Viewers will understand when to use each orientation and how to get the most out of them.
    The viewer will learn how to make their project stand out over others by learning how to change colors and shapes, add spaces, change directions, and add bullets to their charts.

    733 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    23 Experts available now in Live!

    Get 1:1 Help Now