HeaderFooter.Shapes

S

Senad Isanovic

I have 3 different Shapes at the top of the document. Now I'm trying to
write code that will, depending on which optionbox is selected in the
userform, delete other Shapes. (Or bring them to front - sent back). I have
code that will delete the selected shape in the header but this is not
working properly. Thanks!

ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
Selection.HeaderFooter.Shapes("Picture 9").Select
Selection.ShapeRange.Delete
ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument
 
H

Helmut Weber

Hi Senad,

you don't have to select anything
and you don't have to use activepane.

Have a look at this one,
just to show the principle,
and step though it in singlestep mode [F8].

Dim rHdr As Range
Dim oShp As Shape
With ActiveDocument.Sections(1)
Set rHdr = .Headers(wdHeaderFooterPrimary).Range
End With
For Each oShp In rHdr.ShapeRange
oShp.Visible = msoFalse
oShp.Visible = msoTrue
Next
 

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