V
Varun
Guys,
I am not able to figure out why I am getting the subscript out of range
error for the when the below sub is ran...the problem line is:
logical_layer(logicallayernumber) = Buf(buf_idx)
The sub opens up a file then parses each line until the required line is
found and then puts every word in that line into an array named Buf.
I'd like to take the value from the Buf array and put into another (new)
array named logical_layer - can you help me figure out what's wrong?
Thanks for help.
Sub geomsasciiparse()
Dim logical_layer() As Variant
Dim logicallayernumber As Integer
Dim objFSO As Object
Set objFSO = CreateObject("Scripting.FileSystemObject")
Dim objGeomsAsciiFile As Object
Dim Buf() As String
Set objGeomsAsciiFile = objFSO.OpenTextFile(path1 & "\geoms_ascii", 1)
Do While Not objGeomsAsciiFile.AtEndOfStream
strLine = objGeomsAsciiFile.Readline
If InStr(strLine, "_LAYER_DEFINITION") <> 0 Then
Buf() = qc_Split(strLine)
logicallayernumber = Mid(Buf(1), 9, 2)
If logicallayernumber <> "00" Then
For buf_idx = 1 To UBound(Buf)
If InStr(Buf(buf_idx), "SIGNAL") <> 0 Or _
InStr(Buf(buf_idx), "POWER") <> 0 Then
logical_layer(logicallayernumber) = Buf(buf_idx)
Exit For
End If
Next
End If
End If
Loop
objGeomsAsciiFile.Close
End Sub
I am not able to figure out why I am getting the subscript out of range
error for the when the below sub is ran...the problem line is:
logical_layer(logicallayernumber) = Buf(buf_idx)
The sub opens up a file then parses each line until the required line is
found and then puts every word in that line into an array named Buf.
I'd like to take the value from the Buf array and put into another (new)
array named logical_layer - can you help me figure out what's wrong?
Thanks for help.
Sub geomsasciiparse()
Dim logical_layer() As Variant
Dim logicallayernumber As Integer
Dim objFSO As Object
Set objFSO = CreateObject("Scripting.FileSystemObject")
Dim objGeomsAsciiFile As Object
Dim Buf() As String
Set objGeomsAsciiFile = objFSO.OpenTextFile(path1 & "\geoms_ascii", 1)
Do While Not objGeomsAsciiFile.AtEndOfStream
strLine = objGeomsAsciiFile.Readline
If InStr(strLine, "_LAYER_DEFINITION") <> 0 Then
Buf() = qc_Split(strLine)
logicallayernumber = Mid(Buf(1), 9, 2)
If logicallayernumber <> "00" Then
For buf_idx = 1 To UBound(Buf)
If InStr(Buf(buf_idx), "SIGNAL") <> 0 Or _
InStr(Buf(buf_idx), "POWER") <> 0 Then
logical_layer(logicallayernumber) = Buf(buf_idx)
Exit For
End If
Next
End If
End If
Loop
objGeomsAsciiFile.Close
End Sub