swaggerbox
10-03-2014, 02:47 AM
I need help revising the code below. What the macro does is extract all values enclosed with TWO curly brackets, e.g. {{anion}}, but it seems to extract only the first value. How can I change this so that it will be able to extract all values enclosed in curly brackets?
Sub Teststsst()
Dim FileNum As Integer
Dim DataLine As String
FileNum = FreeFile()
Open "C:\Users\XZX\Downloads\BR0613600A2.txt" For Input As #FileNum
While Not EOF(FileNum)
Line Input #FileNum, DataLine
openingParen = InStr(DataLine, "{{")
closingParen = InStr(DataLine, "}}")
enclosedValue = Mid(DataLine, openingParen + 2, closingParen - openingParen - 2)
Debug.Print enclosedValue
Wend
End Sub
Sub Teststsst()
Dim FileNum As Integer
Dim DataLine As String
FileNum = FreeFile()
Open "C:\Users\XZX\Downloads\BR0613600A2.txt" For Input As #FileNum
While Not EOF(FileNum)
Line Input #FileNum, DataLine
openingParen = InStr(DataLine, "{{")
closingParen = InStr(DataLine, "}}")
enclosedValue = Mid(DataLine, openingParen + 2, closingParen - openingParen - 2)
Debug.Print enclosedValue
Wend
End Sub