Results 1 to 17 of 17

Thread: [RESOLVED] Parsing text file

Hybrid View

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jan 2001
    Location
    Ca
    Posts
    124

    Re: Parsing text file

    Sorry

    I've had alot going on and have not had a chance to try some of these.

    Give me a few

  2. #2

    Thread Starter
    Lively Member
    Join Date
    Jan 2001
    Location
    Ca
    Posts
    124

    Re: [RESOLVED] Parsing text file

    Hey Thanks everyone for helping. Lots to learn!

    This is what I'm going with

    VB Code:
    1. Private Sub Command4_Click()
    2. 'Option Explicit
    3.  
    4. Dim intFF As Integer
    5. Dim lngCount As Long, lngIdx As Long
    6. Dim strArr() As String
    7.  
    8. On Error GoTo Err_Handler
    9.  
    10.     intFF = FreeFile
    11.  
    12.     'Load the TextFile into an Array
    13.     Open App.Path & "\" & Text1.Text For Input As #intFF
    14.     strArr() = Split(Input(LOF(intFF), 1), vbCrLf)
    15.     Close #intFF
    16.  
    17.     'Now, pass tru each Array element and look for a match
    18.     lngCount = UBound(strArr) - 1
    19.  
    20.     For lngIdx = 0 To lngCount
    21.         If InStr(1, strArr(lngIdx), "F", vbTextCompare) <> 0 And Left$(strArr(lngIdx), 1) <> "(" Then
    22.             If IsNumeric(Trim$(Right$(strArr(lngIdx), Len(strArr(lngIdx)) - InStrRev(strArr(lngIdx), "F", -1, vbTextCompare)))) Then
    23.  
    24.                 MsgBox Trim$(Right$(strArr(lngIdx), Len(strArr(lngIdx)) - InStrRev(strArr(lngIdx), "F", 1, vbTextCompare)))
    25.  
    26.                 End If
    27.         End If
    28.     Next
    29.  
    30. Exit Sub
    31.  
    32. Err_Handler:
    33.     MsgBox "Number: " & Err.Number & vbCrLf & _
    34.     "Description: " & Err.Description, vbOKOnly + vbInformation, "Error!"
    35.  
    36. End Sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width