Dears,
I've the following Macro which is responsible for finding the airport into a TXT. file. It's working perfectly, when the airport is found the macro returns the airport information, at the first line.
Sub FindAirportDep()
Dim fn As String, txt As String, delim As String, a() As String
Dim i As Long, ii As Long, iii As Long, n As Long, X, Y
fn = "C:\Users\bruno\Desktop\FMS ATR\DataBase\Airports.txt" ' Change here (File Path)
delim = "|" ' Change here (delimiter)
temp = CreateObject("Scripting.FileSystemObject").OpenTextFile(fn).ReadAll
X = Split(temp, vbCrLf)
ReDim a(1 To UBound(X) + 1, 1 To 100)
For i = 0 To UBound(X)
If InStr(1, X(i), DepAirport, 1) > 0 Then
n = n + 1: Y = Split(X(i), delim)
DepNameAirport = Y(2)
DepLatitude = Y(3)
DepLongitude = Y(4)
DepElevation = Y(5)
Do While lin <> ""
Loop
End If
Next i
End Sub
But an airport may have more than 2 runways... sometimes 5, up to 10 runways... an in my database each line starting with an "R" represents a runway for that specific airport. The last line is an empty line, and after that we will have another airport...
So, how can add to my code the function to collect all runway information from that specifc airport?
Check my database format:
A|24AZ|PLEASANT VALLEY|34158097|-110935403|5688
R|06|60|3950|0|0|0|34157715|-110937309|5688|300|40
R|24|240|3950|0|0|0|34161064|-110924858|5688|300|40
A|24MO|MISTWOOD|38133364|-92833522|760
R|07|70|2800|0|0|0|38132309|-92838211|760|300|40
R|25|250|2800|0|0|0|38134422|-92828827|760|300|40
A|25NV|PARKER CARSON|39201578|-119683442|4939
R|06|44|815|0|0|0|39201025|-119684689|4939|300|40
R|18|180|2200|0|0|0|39201578|-119683442|4900|300|50
R|24|224|815|0|0|0|39202133|-119682192|4937|300|40
R|36|360|2200|0|0|0|39201578|-119683442|4900|300|50
I've the following Macro which is responsible for finding the airport into a TXT. file. It's working perfectly, when the airport is found the macro returns the airport information, at the first line.
Sub FindAirportDep()
Dim fn As String, txt As String, delim As String, a() As String
Dim i As Long, ii As Long, iii As Long, n As Long, X, Y
fn = "C:\Users\bruno\Desktop\FMS ATR\DataBase\Airports.txt" ' Change here (File Path)
delim = "|" ' Change here (delimiter)
temp = CreateObject("Scripting.FileSystemObject").OpenTextFile(fn).ReadAll
X = Split(temp, vbCrLf)
ReDim a(1 To UBound(X) + 1, 1 To 100)
For i = 0 To UBound(X)
If InStr(1, X(i), DepAirport, 1) > 0 Then
n = n + 1: Y = Split(X(i), delim)
DepNameAirport = Y(2)
DepLatitude = Y(3)
DepLongitude = Y(4)
DepElevation = Y(5)
Do While lin <> ""
Loop
End If
Next i
End Sub
But an airport may have more than 2 runways... sometimes 5, up to 10 runways... an in my database each line starting with an "R" represents a runway for that specific airport. The last line is an empty line, and after that we will have another airport...
So, how can add to my code the function to collect all runway information from that specifc airport?
Check my database format:
A|24AZ|PLEASANT VALLEY|34158097|-110935403|5688
R|06|60|3950|0|0|0|34157715|-110937309|5688|300|40
R|24|240|3950|0|0|0|34161064|-110924858|5688|300|40
A|24MO|MISTWOOD|38133364|-92833522|760
R|07|70|2800|0|0|0|38132309|-92838211|760|300|40
R|25|250|2800|0|0|0|38134422|-92828827|760|300|40
A|25NV|PARKER CARSON|39201578|-119683442|4939
R|06|44|815|0|0|0|39201025|-119684689|4939|300|40
R|18|180|2200|0|0|0|39201578|-119683442|4900|300|50
R|24|224|815|0|0|0|39202133|-119682192|4937|300|40
R|36|360|2200|0|0|0|39201578|-119683442|4900|300|50