?
Solved

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

Posted on 2011-10-07
5
Medium Priority
?
374 Views
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,

Thomas
0
Comment
Question by:Staudte
  • 3
  • 2
5 Comments
 
LVL 76

Accepted Solution

by:
GrahamSkan earned 2000 total points
ID: 36936148
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?
0
 

Author Closing Comment

by:Staudte
ID: 36938895
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...

Thanks,
Thomas
0
 
LVL 76

Expert Comment

by:GrahamSkan
ID: 36939054
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)
            rng.Cut
            sh.TextFrame.TextRange.Paste
            .Delete
            For Each brd In rng.Paragraphs.First.Borders
                brd.LineStyle = wdLineStyleNone
            Next brd
        End With
    Loop

End Sub

Open in new window

0
 

Author Comment

by:Staudte
ID: 36939211
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!
Thomas
0
 
LVL 76

Expert Comment

by:GrahamSkan
ID: 36939225
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.
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Shortcuts in Word Just the other day I had a training for Microsoft and they wanted me to show how well the new Windows and Office behaved on a touch device, which by the way is great, but it was only then that I realized that using keyboard shortc…
This is written from a 'VBA for MS Word' perspective, but I am sure it applies to most other MS Office components where VBA is used.  One thing that really bugs me is slow code, ESPECIALLY when it's mine!  In programming there are so many ways to…
This video walks the viewer through the process of creating Hyperlinks for the web and other documents. Select the "Insert" tab: Click "Hyperlink":  Type "http://" followed by a web address to reference a website or navigate to a document to ref…
This Experts Exchange video Micro Tutorial shows how to tell Microsoft Office that a word is NOT spelled correctly. Microsoft Office has a built-in, main dictionary that is shared by Office apps, including Excel, Outlook, PowerPoint, and Word. When …
Suggested Courses

850 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