Delete textbox inside the primary footer

N

NavyPsych

Okay, I've spent hours on this. It shouldn't be this hard (and
probably isn't) but everything I've found on the entire internet (only
a small exaggeration) hasn't worked.

And I just can't go to the footer and wipe it out cuz I spent the last
10 hours of my life bookmarking some things in the footer, formatting
text around them, etc. Please help. Thanks.
 
G

Greg Maxey

Sub Scratchmacro()
Dim oRng As Word.Range
Dim oShp As Shape
Set oRng = ActiveDocument.StoryRanges(wdPrimaryFooterStory)
For Each oShp In oRng.ShapeRange
If oShp.Type = msoTextBox Then
oShp.Delete
End If
Next
End Sub
 
N

NavyPsych

It's giving me "Requested object not available" at line: For Each
oShp In oRng.ShapeRange

Maybe I'm wrong in assuming that this is a textbox, and it is in fact,
inside the footer, so let me describe: First of all, it LOOKS like
every textbox I've ever used, and it is "greyed out" (and
unaccessable) until you enter the footer, then you can select it, an
anchor appears, and if you right click if gives you an option to
"Format Frame." Once selected you can hit the <delete> key and it's
gone.

So, it looks and acts like a textbox, so I'm assuming it is. And it is
definitely in the footer (it's the primary footer b/c the doc is not
set up for different odd/even or anything like that). Any idea what's
going on?

Thanks for you help with this.
 
G

Greg Maxey

Come on Chief. If it says "format frame" it might be a frame ;-)

Try:

Sub Scratchmacro()
Dim oRng As Word.Range
Dim oFrame As Word.Frame
Set oRng = ActiveDocument.StoryRanges(wdPrimaryFooterStory)
For Each oFrame In oRng.Frames
oFrame.Range.Delete 'Deletes the text in the frame
oFrame.Delete 'Deletes the frame (leaves the text)
Next
End Sub
 

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