VBA/Excel/Access/Word/File Path/Binary File

Материал из VB Эксперт
Перейти к: навигация, поиск

create temporary binary file test.bin

 
Option Explicit
Private Sub CreateBinaryFile()
  Dim sq As Double, i
  Open Environ("temp") + "\test.bin" For Binary As #1
  For i = 1 To 100
    sq = Sqr(i)
    Put #1, , sq
  Next i
  Close #1
End Sub



open file, show first three entries in immediate window

 
Private Sub LoadBinaryFile()
  Dim dbl As Double, i
  Open Environ("temp") + "\test.bin" For Binary As #1
  Seek #1, 8 * 14 + 1
  For i = 1 To 3
    Get #1, , dbl
    Debug.Print dbl
  Next i
  Close
End Sub