module.bas

来自「在VB中实现通讯的例子」· BAS 代码 · 共 37 行

BAS
37
字号
'
' VBA (EXCEL/ACCESS/WORD) Module Code
'

Const Port = COM1

Function OpenPort ()
Dim Code As Integer
Code = SioReset(Port, 512, 512)
Code = SioBaud(Port, Baud9600)
Code = SioParms(Port, NoParity, OneStopBit, WordLength8)
Code = SioDTR(Port, SET_LINE)
OpenPort = Code
End Function

Function ClosePort()
ClosePort = SioDone(Port)
End Function

Function GetByte()
GetByte = SioGetc(Port)
End Function

Function PutAT()
Dim Code As Integer
Code = SioPutc(Port, Asc("A"))
Code = SioPutc(Port, Asc("T"))
PutAT = SioPutc(Port, 13)
End Function

Function PutByte (TheByte)
Dim Code As Integer
Code = SioPutc(Port, TheByte)
PutByte = Code
End Function

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?