Link to home
Start Free TrialLog in
Avatar of Andrey-21
Andrey-21Flag for United States of America

asked on

How to remove MS WORD frames properly?

Hello experts!

  I've run into the save situation as many many others here: there is generated MS WORD
document having frames. My DOC document was prepared by Oracle Reports 10g software. The problem is the same: multiple frames do not allow me to edit generated document in
MS Word. I've tried the macros published here as a solutions of similar problems, but they
messed up my DOC file: all alignments were destroyed...
   Having long time experience in Oracle, I have very limited knowledge of VB.
   Please, help me to improve the following macro so that it produces a file with
frames removed and all alignments of text and paragraphs to be the same as in the original
file:

Sub DeleteAllDocframes()
    Dim frm As Frame
    Dim rng As Range
    Dim brd As Border
    Dim para As Paragraph
    For Each frm In ActiveDocument.Frames
        Set rng = frm.Range
        frm.Delete
        'Delete the borders left behind
        For Each para In rng.Paragraphs
            For Each brd In para.Borders
                brd.LineStyle = wdLineStyleNone
            Next brd
        Next para
    Next frm
End Sub

 To make your work a little bit easier, I've attached my DOC document.
All data mentioned in it are synthetic (for testing purposes).
  Thanks a lot in advance!

Andrey

wadmgrs-tst.doc
Avatar of GrahamSkan
GrahamSkan
Flag of United Kingdom of Great Britain and Northern Ireland image

I think that the software has used frames so that each piece of text can be positioned precisely.

The positioning is quite variable and complex, with different alignments within the frames. It would be very difficult to achieve the same layout without frames (or text boxes), and to write some code to convert the document automatically would be more of a project than a tip.

The first two frames are no problem. The second and third are at the same vertical displacement, so their two paragraphs would need to be rejoined into a single paragraph, separated by a tab character with the tab stop positioned where the second frame in the line starts. The next few lines are the same except that the lines would need indenting. The address lines are a real problem. The text has central alignment, but does not use the page centre, but a position about five centimetres from the left-hand margin

Can you tell us what difficulty you are having in editing the document? Perhaps there is another way around that.
Avatar of Andrey-21

ASKER

Hello Graham Skan!

  Thanks a lot for looking into the issue! I appreciate your describes of the file structure features.
Regarding to your question about issue of editing the file I can say the following: I have to add
some new rows at any section (common info, addresses, education etc). For a while the only way
to edit the file is to add  (or edit) existing content in those frames only. I'm experiencing real troubles
trying insert new empty space (rows) between the frames to be able to type some other text
in it. The problem becomes even worse because such an operations (adding a new lines) have to be
done at virtually any location in the file.
  So, Graham if you give me a tip how that can be done - it would be a real help for me.
Thanks a lot anyway!

Andrey
ASKER CERTIFIED SOLUTION
Avatar of GrahamSkan
GrahamSkan
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial