不知道你什么意思,是否按位显示01,那可以这样
Private Sub Command1_Click()
Dim s As String, vbuf As Variant
'vbuf 是数值类型时
vbuf = 170
Form1.Print "vbuf ="; vbuf; "时的二进制位:"
For i = 7 To 0 Step -1
Form1.Print "第"; 8 - i; "位 = "; IIf((vbuf And (2 ^ i)) = (2 ^ i), 1, 0)
Next
Form1.Print
'vbuf 是字符类型时
vbuf = "X"
vbuf = Asc(vbuf)
Form1.Print "vbuf = ""X"" 时的二进制位:"
For i = 7 To 0 Step -1
Form1.Print "第"; 8 - i; "位 = "; IIf((vbuf And (2 ^ i)) = (2 ^ i), 1, 0)
Next
End Sub