Visual Basic "Error! AutoText Entry not defined" error

I have the following code:
.Range.Fields.Add(.Range, Microsoft.Office.Interop.Word.WdFieldType.wdFieldEmpty, "AUTOTEXT  ""Page X of Y"" ", True)

It worked correctly using Word 2002 SP3. However, when creating a Word document to Word 2007, "Error! AutoText Entry not defined" appears instead of "Page 1 of 8", for example.
msukowAsked:
Who is Participating?
 
Skiboy9Connect With a Mentor Commented:
If all you want to do is add a Page X of Y in the lower left page footer, here is the code to do it.  Let me know if you require more.
    WordBasic.ViewFooterOnly
    ActiveDocument.AttachedTemplate.BuildingBlockEntries("Bold Numbers 1"). _
        Insert Where:=Selection.Range, RichText:=True

Open in new window

0
 
msukowAuthor Commented:
Thanks - it will take me about a week to get to this issue - priorities have changed so this is now on the back burner.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.