您的问题我今天也遇到了,在百度上查到解决方法.
Option Explicit
Dim ReceiveBuffer() As Byte
Private Sub Command1_Click()
ReDim ReceiveBuffer(2) As Byte
ReceiveBuffer(0) = &H31
ReceiveBuffer(1) = &H32
ReceiveBuffer(2) = &H33
Call SaveFile
End Sub
Private Sub SaveFile()
Dim FileId As Integer
Dim StrFileName As String
Dim i As Integer
Dim str$
str = Format$(Now, "yyyy-mm-dd_hh_mm_ss")
StrFileName = App.path + "\" + str + ".bin"
FileId = FreeFile()
Open StrFileName For Binary As #FileId
Put #FileId, , ReceiveBuffer()
Close #FileId
End Sub