joi2
Nov 1st, 2005, 07:48 AM
I am having problems with this code every time I run the code I get an error when this loop runs. what I am trying to do is pick up anything that appears between the words application and platform for example (platform blah, blah, blah, application)and when i run the loop after it finds the first case it gives me an error saying "Ivalid procedure call or argument". heres a copy of the code an i=2105 and j=553
Sub test1()
Dim r As Range
Dim rword As Range
Dim h As Long, l As Long
Dim xlApp As Excel.Application
Dim xlWB As Excel.Workbook
'With ActiveDocument
Dim seastring1 As String
Let seastring1 = ThisDocument.Content
Const seastring2 As String = "Application:"
Const pook As String = "Platform:"
Dim j As Long
Dim i As Long
j = InStr(seastring1, seastring2)
i = InStr(1, seastring1, pook)
Do While i <> 0
MsgBox Mid$(seastring1, i, j - i), Len(Mid$(seastring1, i, j - i))
'MsgBox pook & i
'MsgBox Mid$(seastring1, i, InStr(seastring1, seastring2) - i) ', Len(Mid$(seastring1, i, InStr(seastring1, seastring2) - i ))
i = InStr(i + 1, seastring1, pook)
Loop
'End With
End Sub
Sub test1()
Dim r As Range
Dim rword As Range
Dim h As Long, l As Long
Dim xlApp As Excel.Application
Dim xlWB As Excel.Workbook
'With ActiveDocument
Dim seastring1 As String
Let seastring1 = ThisDocument.Content
Const seastring2 As String = "Application:"
Const pook As String = "Platform:"
Dim j As Long
Dim i As Long
j = InStr(seastring1, seastring2)
i = InStr(1, seastring1, pook)
Do While i <> 0
MsgBox Mid$(seastring1, i, j - i), Len(Mid$(seastring1, i, j - i))
'MsgBox pook & i
'MsgBox Mid$(seastring1, i, InStr(seastring1, seastring2) - i) ', Len(Mid$(seastring1, i, InStr(seastring1, seastring2) - i ))
i = InStr(i + 1, seastring1, pook)
Loop
'End With
End Sub