brodaddy2002
Board Regular
- Joined
- Jan 21, 2013
- Messages
- 67
I have the following code below. I am trying to read DTED data into excel. I am not really sure what I am doing, but I think I am close. A couple of questions.
1) Can we use for input instead of Binary Access Read in the Open statement? I couldn't get for input to work.
2) Why do we not need a hash in front of intFileNum
3) What type variable is intFileNum?
4) Why isn't temp changing values? It when I try to do arithmetic?
Any help will be greatly appreciated
1) Can we use for input instead of Binary Access Read in the Open statement? I couldn't get for input to work.
2) Why do we not need a hash in front of intFileNum
3) What type variable is intFileNum?
4) Why isn't temp changing values? It when I try to do arithmetic?
Any help will be greatly appreciated
Code:
Public Sub reading3()
Dim intFileNum, bytTemp As Integer
Dim Letter As String
Dim i As Long
Dim j As Long
Dim test() As Integer
'Dim NewArray() As Integer
Dim x As Long
Dim temp As Integer
j = 1
intFileNum = FreeFile
Open "C:\Users\x\Documents\Thesis\Fallon DTED\rasexp_dted_1365124850_77725\dted\w114\n35.dt0" For Binary Access Read As intFileNum
'Seek intFileNum, 2
EData = filelen("C:\Users\x\Documents\Thesis\Fallon DTED\rasexp_dted_1365124850_77725\dted\w114\n35.dt0")
x = EData - 3428
ReDim NewArray(0 To EData) As Variant
For i = 3428 To EData
Seek intFileNum, i
Get intFileNum, , bytTemp
temp = bytTemp
If temp < 0 Then
temp = -1 * ((temp + 32767) + 1)
End If
Debug.Print bytTemp
Range("A" & j) = bytTemp
j = j + 1
' For j = 0 To (EData - 3428)
' NewArray(j) = bytTemp
' Next
'Letter = Chr(bytTemp)
Next
Debug.Print Letter
Close intFileNum
End Sub