Hi,
I think a lot at once is rarely a good idea. ;-)
1st, to get the strings to be transferred to Excel:
Sub test783()
Dim rTmp As Range
Dim s As String ' String for excel
Set rTmp = ActiveDocument.Range
ResetSearch
With rTmp.Find
.Text = "Graphic*:"
.MatchCase = True
.MatchWildcards = True
While .Execute
rTmp.Collapse direction:=wdCollapseEnd
.Text = "*."
.Execute
s = Trim(rTmp.Text)
' to get rid of leading and trailing spaces
s = Left(s, Len(s) - 1)
' to get rid of the trailing full stop
MsgBox "transfer to Excel: " & s
rTmp.Collapse direction:=wdCollapseEnd
rTmp.End = ActiveDocument.Range.End
.Text = "Graphic*:"
Wend
End With
ResetSearch
End Sub
Public Sub ResetSearch()
With Selection.Find
.ClearFormatting
.Replacement.ClearFormatting
.Text = ""
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
' plus some more if needed
.Execute
End With
End Sub
Then you would need something which tells you,
whether you are on a new page.
OK, start with page 1, the initial value.
Check whether rTmp.Information(wdActiveEndPageNumber)
is equal to initial value. If so, you are on the same page,
if not you are on a new page. Then set the inital value to
the new page.
Sub test784()
Dim rTmp As Range
Dim lPg1 As Long
Dim lPgx As Long
Set rTmp = ActiveDocument.Range
lPg1 = 1
ResetSearch
With rTmp.Find
.Text = "the"
While .Execute
lPgx = rTmp.Information(wdActiveEndPageNumber)
If lPgx <> lPg1 Then
MsgBox "Old page = " & lPg1 & " New Page = " & lPgx
lPg1 = lPgx
End If
Wend
End With
ResetSearch
End Sub
Of course, in no way all you want.
But I'd say, try to get comfortable with that at first,
and then ask again.
Without learning some VBA it'll be hard.
Greetings from Bavaria, Germany
Helmut Weber, MVP
"red.sys" & chr(64) & "t-online.de"
Word XP, Win 98
http://word.mvps.org/