Hi All,

I am not an ardent developer in vb.net programming. But off late I am using vb.net to develop a windows application.

The following is what I am trying to do:

I am reading an excel file and storing the string value present in each cell, and trying to match the string in a word file.

The program works fine except that I am having problems in returning the page numbers of the matched string.

The page number value is always returned as one.

The following is a piece of what I had written:

If FindStringInFile(wordfilename, vValues) Then
currentPageNumber = word.ActiveDocument.ActiveWindow.Selection.Range.Information(Microsoft.Office.Interop.Word.WdInformation.wdActiveEndAdjustedPageNumber)
TextBox3.Text = currentPageNumber
End If

wordfilename is my word file and vValues is my excel string data

Thanks in Advance for the help!

1. Which reference did you use? (Microsoft Office runtime library?)
2. If your FindStringInFile actually finds the given string then you should put that "currentPageNumber" line of code inside it (maybe you already put the page number into a local variable but tried to use it as a global variable?)
3. Your answer lies surely inside that FindStringInFile function... If you can find the string you should be able to find the page also...

Other than that I can't think of anything atm... Never used word.ActiveDocument myself...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.18 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.