VBA/Excel/Access/Word/File Path/Binary File — различия между версиями

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

Текущая версия на 12:47, 26 мая 2010

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