M
MikeZz
I should preface by saying I'm running this routine from Excel 2003 VBA but
I'm not sure if that will make a difference in the answer.
When ever I run this sub, and get to line: .Text = sText , it causes Excel
to immediatly crash and re-start.
All I'm trying to do is get the Start & End Locations of a string in a long
word document. I'd also like the option of getting the next table #
following the string as indicated with the optional variable: GetNextTable.
Just an FYI, my word VBA experience is zero so if you can help, please use
full & correct syntax. If there's an error, I won't have a clue how to find
it.
Any help would be GREATLY appreciated!
Thanks
MikeZz
Private Sub w01_Find_This_String(sText As String, oRg As Word.Range,
Optional GetNextTable)
Dim oTable As Table
Set oRg = ActiveDocument.Range
With oRg.Find
.ClearFormatting
.Text = sText
.Forward = True
.Wrap = wdFindStop
.Format = False
.MatchWildcards = False
Do While .Execute
oRg.Collapse wdCollapseEnd
Loop
End With
End Sub
I'm not sure if that will make a difference in the answer.
When ever I run this sub, and get to line: .Text = sText , it causes Excel
to immediatly crash and re-start.
All I'm trying to do is get the Start & End Locations of a string in a long
word document. I'd also like the option of getting the next table #
following the string as indicated with the optional variable: GetNextTable.
Just an FYI, my word VBA experience is zero so if you can help, please use
full & correct syntax. If there's an error, I won't have a clue how to find
it.
Any help would be GREATLY appreciated!
Thanks
MikeZz
Private Sub w01_Find_This_String(sText As String, oRg As Word.Range,
Optional GetNextTable)
Dim oTable As Table
Set oRg = ActiveDocument.Range
With oRg.Find
.ClearFormatting
.Text = sText
.Forward = True
.Wrap = wdFindStop
.Format = False
.MatchWildcards = False
Do While .Execute
oRg.Collapse wdCollapseEnd
Loop
End With
End Sub