'======================================== Function zStr_ExtractN(sInput, iPos, sFrom, sTo) Dim iLoop, iLen, iPosn, sLine 'Find the position of the Nth occurence of the from string... sLine = sInput iLen = Len(sFrom) For iLoop = 1 To iPos iPosn = inStr(sLine,sFrom) If iPosn = 0 Then Print "zStr_ExtractN - Failed - From String Not Found - occurence: " & cStr(iLoop) zStr_ExtractN = "" Exit Function End If sLine = Mid(sLine,iPosn + iLen) Next iPosn = inStr(sLine,sTo) If iPosn = 0 Then Print "zStr_ExtractN - Failed - To String Not Found" zStr_ExtractN = "" Exit Function End If zStr_ExtractN = Left(sLine,iPosn-1) End Function '========================================