Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / August 2007

Tip: Looking for answers? Try searching our database.

Delete all frames in a document including the text located in these frames

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
andreas - 21 Aug 2007 08:23 GMT
Dear Experts:
I would like to be able to delete ALL FRAMES in a document using VBA.
Below macro regrettably only deletes the frames but not the text that
is located in the frames. How can I ask Word to delete the frames
including the contents of these frames. Help is appreciated.  Thank
you very much in advance.

Regards, Andreas

Sub RemoveFrames()
'Deleting all frames in a document
Dim frm As Frame
For Each frm In ActiveDocument.Frames
frm.Delete
Next frm
End Sub
Graham Mayor - 21 Aug 2007 09:31 GMT
You can delete the text with a frame parameter using Replace

Sub ReplaceExample()
With Selection
   .HomeKey Unit:=wdStory
   With .Find
       .ClearFormatting
       .Replacement.ClearFormatting
'**********************
       .Text = ""
       .Frame.TextWrap = True
       .Replacement.Text = ""
'**********************
       .Forward = True
       .Wrap = wdFindContinue
       .Format = True
       .MatchCase = False
       .MatchWholeWord = False
       .MatchAllWordForms = False
       .MatchSoundsLike = False
       .MatchWildcards = False
       .Execute replace:=wdReplaceAll
   End With
End With
End Sub

Signature

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor -  Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>

> Dear Experts:
> I would like to be able to delete ALL FRAMES in a document using VBA.
[quoted text clipped - 12 lines]
> Next frm
> End Sub
andreas - 23 Aug 2007 07:48 GMT
> You can delete the text with a frame parameter using Replace
>
[quoted text clipped - 48 lines]
>
> - Zitierten Text anzeigen -

Graham,

thank you very  much. It is working fine. Regards, Andreas
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.