Removing paragraph frames with VBA

S

Santiago Gomez

Hello,
I scanned a document and did OCR on it. The accuracy was excellent, but
every paragraph is inside a frame. I can remove the frames manually but it
will take forever.

Is there a way (using the Range.Frames. property someone posted here
earlier) to remove all the frames inside a document?

Any help would be appreciated.

Thanks.
 
J

Jay Freedman

Santiago said:
Hello,
I scanned a document and did OCR on it. The accuracy was excellent,
but every paragraph is inside a frame. I can remove the frames
manually but it will take forever.

Is there a way (using the Range.Frames. property someone posted here
earlier) to remove all the frames inside a document?

Any help would be appreciated.

Thanks.

Here's a quote of my answer to an identical question some months ago:
Hi All - Is there a way to delete all frames in a word
document at once? My scanner OCR's text into Word, but
puts it into multiple frames. Any ideas?

Hi Rob,

This little macro will remove all the frames...

Sub ZapFrames()
ActiveDocument.Frames.Delete
End Sub

(See http://www.gmayor.com/installing_macro.htm if necessary.)

You may not be happy with the result, though. When the frame goes away, the
text that was in it gets deposited at the point where the frame's anchor
was. If that point is the beginning of the paragraph of regular text
immediately following the frame's position, all will be well -- but my
experience is that OCR programs tend to anchor all their frames at the top
left corner of the page. You could easily wind up with a lot of scrambled
eggs. :-(

Another possible complication is that the macro will delete only frames
whose anchors are in the main body of the document. If there are any frames
tucked into headers, footers, footnotes, or other "stories" (Word's term),
that will take a bit more effort.
 
S

Santiago Gomez

that is amazing.
thanks!

Jay Freedman said:
Here's a quote of my answer to an identical question some months ago:


Hi Rob,

This little macro will remove all the frames...

Sub ZapFrames()
ActiveDocument.Frames.Delete
End Sub

(See http://www.gmayor.com/installing_macro.htm if necessary.)

You may not be happy with the result, though. When the frame goes away,
the
text that was in it gets deposited at the point where the frame's anchor
was. If that point is the beginning of the paragraph of regular text
immediately following the frame's position, all will be well -- but my
experience is that OCR programs tend to anchor all their frames at the top
left corner of the page. You could easily wind up with a lot of scrambled
eggs. :-(

Another possible complication is that the macro will delete only frames
whose anchors are in the main body of the document. If there are any
frames
tucked into headers, footers, footnotes, or other "stories" (Word's term),
that will take a bit more effort.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top