Hello, please help if you are able. I am using VBA in Excel XP with Windows 2K to automate Word XP

I have a program that automates several Word documents from Excel. They all work fine, except one Word document. My code opens the Word document and then it is supposed to activate a specific page. The problem is, the document always stays on page one no matter which page the program tries to activate

I can not find any formatting in the problem document that is any different from any of the other documents I'm automating successfully. It consists of 3 pages in one section with paging beginning at 3. I even tried putting in hard page breaks, but it still refuses to activate any page other than page 1. Can someone think of a reason why this problem would occur
FYI, my code follows if you need it

'*****************************************

Dim strFileName As Strin
Dim wrdApp As Word.Applicatio

'Create an object reference to the running instance of Wor
Set wrdApp = CreateObject("Word.Application"

'Open the file read onl
wrdApp.Application.Documents.Open
strFullSourceFileName,
False,
True,
False,
"",
"",
Fals

'Ensure opened file is visible and activate i
wrdApp.Visible = Tru
wrdApp.Activat

'Go to the page desire
wrdApp.Selection.Goto What:=wdGoToPage, Name:=intSourcePage '< my variable that should activate page

**************************************

TIA for your assistance

Re: Word document does not obey "GoTo" command by Perry

Perry
Mon Jan 26 12:50:32 CST 2004

Try something like:

Dim wrdApp As New Word.Application
Dim wrdDoc As Word.Document
Dim sFileName as String

sFileName = "c:\temp\MyFullFileNameToReplace.doc"
wrdApp.Visible = True

Set wrdDoc = wrdApp.Documents.Open(sFileName)
wrdApp.Selection.GoTo what:=wdGoToPage, Name:=2
wrdDoc.Windows(1).Visible = True

Krgrds,
Perry

"clueless" <anonymous@discussions.microsoft.com> wrote in message
news:4A96CEB6-2FF4-4277-995C-BAF73B1D48AD@microsoft.com...
> Hello, please help if you are able. I am using VBA in Excel XP with
Windows 2K to automate Word XP.
>
> I have a program that automates several Word documents from Excel. They
all work fine, except one Word document. My code opens the Word document and
then it is supposed to activate a specific page. The problem is, the
document always stays on page one no matter which page the program tries to
activate.
>
> I can not find any formatting in the problem document that is any
different from any of the other documents I'm automating successfully. It
consists of 3 pages in one section with paging beginning at 3. I even tried
putting in hard page breaks, but it still refuses to activate any page other
than page 1. Can someone think of a reason why this problem would occur?
> FYI, my code follows if you need it:
>
> '******************************************
>
> Dim strFileName As String
> Dim wrdApp As Word.Application
>
> 'Create an object reference to the running instance of Word
> Set wrdApp = CreateObject("Word.Application")
>
> 'Open the file read only
> wrdApp.Application.Documents.Open _
> strFullSourceFileName, _
> False, _
> True, _
> False, _
> "", _
> "", _
> False
>
> 'Ensure opened file is visible and activate it
> wrdApp.Visible = True
> wrdApp.Activate
>
> 'Go to the page desired
> wrdApp.Selection.Goto What:=wdGoToPage, Name:=intSourcePage '< my
variable that should activate page.
>
> ***************************************
>
> TIA for your assistance.
>