Link to home
Start Free TrialLog in
Avatar of Mojo_Moxie
Mojo_Moxie

asked on

Removal of frames in large Word 2007 files that were converted from PDF

I work with a lot of PDF documents that were created by being scanned. After running OCR Text Recognition, I can often convert these to Microsoft Word. The issue is the conversion process places each paragraph into a frame, and it is time consuming to remove these.

I found a macro here on Experts Exchange that worked to remove the frames in smaller documents, but when I run this macro on my file, which is 6.0 MB, it causes Word to "stop responding" and when it restarts my file shows as a "recovered" file.

I need a workable solution to remove multiple frames for large file types.

:-) In advance - much thanks.
Avatar of GrahamSkan
GrahamSkan
Flag of United Kingdom of Great Britain and Northern Ireland image

Can you indicate which macro you are using, so we don't go down the same path?
Avatar of Mojo_Moxie
Mojo_Moxie

ASKER

Sub remfrm()
Option Explicit

Sub DelteAllDocFrames()
    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
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
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.