Selecting AutoText Graphics

  • Thread starter Roderick O'Regan
  • Start date
R

Roderick O'Regan

I've inserted in the firstpagefooter a recycle paper logo which is
saved in the template as AutoText.

I use the following code to do this:
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageFooter
'enters the autotext graphic located in the attached Template
ActiveDocument.AttachedTemplate.AutoTextEntries("Recycle").Insert
_
Where:=Selection.Range, RichText:=True
'returns to the main document
ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument

The footer consists of a few lines of text holding the office address
details.

The logo is a floating graphic.

What I'd like to do is to give it a name so that later on when users
want to remove it I can say something like:
"Go and find the XYZ named graphic in the firatpagefooter and remove
it"

This is well explained in the VBA help.

But how do I give it a name in the first place considering it is
AutoText?

Can anyone help, please?

Roderick
 
H

Helmut Weber

Hi Roderick,

something along the following lines.

Sub Macro7()
Dim rFtr As Range
Set rFtr = ActiveDocument.StoryRanges(wdPrimaryFooterStory)
ActiveDocument.AttachedTemplate.AutoTextEntries("Logo").Insert _
Where:=rFtr.Characters(1), RichText:=True
rFtr.InlineShapes(1).ConvertToShape
rFtr.ShapeRange(rFtr.ShapeRange.Count).Name = "Logo"
End Sub
' ------------------------------------
Sub Macro11()
Dim rFtr As Range
Dim rShp As Shape
Set rFtr = ActiveDocument.StoryRanges(wdPrimaryFooterStory)
For Each rShp In rFtr.ShapeRange
If rShp.Name = "Logo" Then rShp.Delete
Next
End Sub

Which requires a footer to be there at first.
But that isn't the problem, isn't it?

--
Gruß

Helmut Weber, MVP WordVBA

"red.sys" & chr$(64) & "t-online.de"
Win XP, Office 2003 (US-Versions)t first.

HTH
 

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