Macros, headers & Textboxes

B

Bernard Sweeney

Word 2002 SP3 on XP Pro

While recording a macro I was unable to select a textbox
in the document header which I wanted to delete (contents
& Textbox). I have no problem doing this when not
recording or after pausing recording.

Any ideas?
 
H

Helmut Weber

Hi Bernard,
the following deletes any(!) textbox in the primary
header of section 1 of the active document.
---
' Header wdHeaderFooterPrimary = 1
Dim rHdr As Range
Dim oShp As Shape
Set rHdr = ActiveDocument.Sections(1).Headers(1).Range
For Each oShp In rHdr.ShapeRange
If oShp.Type = msoTextBox Then
oShp.Delete
End If
Next
---
If you want to delete a specific textbox,
you would have to identify it somehow.
Greetings from Bavaria, Germany
Helmut Weber, MVP
"red.sys" & chr(64) & "t-online.de"
Word XP, Win 98
 

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