The following bit of code really annoys me. Let me explain a bit. This is from XL. A Word doc search has made its' find and all you want to do is find the paragraph location of the find and make a range of it. The following codes are only needed when the found paragraph is on a last page line and you want to expand the range to the next page. Word seemed to get confused in 2001 vs my 2003 upgrade (see code... both are the same with commented out code(2003) and numeric values) Is this an upgrade or do I have a Word option messing with me again? Dave
mS2001premium
[VBA]
'adjust for pages
If Wapp.Selection.Information(wdActiveEndPageNumber) > 1 Then
If Wapp.Selection.Information(wdFirstCharacterLineNumber) <> 46 Then
Adjust = Wapp.Selection.Information(wdActiveEndPageNumber) * 46 - 46
Else
Adjust = (Wapp.Selection.Information(wdActiveEndPageNumber) - 1) * 46 - 46
End If
End If
FirstParaloc = Wapp.Selection.Information(wdFirstCharacterLineNumber) + Adjust
Set Myrange = Wapp.ActiveDocument.Paragraphs(FirstParaloc).Range
[/VBA]
ms2003
[VBA]
If Wapp.Selection.Information(3) > 1 Then
'If Wapp.Selection.Information(10) <> 46 Then
Adjust = Wapp.Selection.Information(3) * 46 - 46
'Else
'Adjust = (Wapp.Selection.Information(3) - 1) * 46 - 46
'End If
End If
FirstParaloc = Wapp.Selection.Information(10) + Adjust
Set Myrange = Wapp.ActiveDocument.Paragraphs(FirstParaloc).Range
[/VBA]