打开任何数据类型的文件,用二进制都可以办到,打开文本文件,代码如下:
dim filepath
dim st as adodb.stream
set st=new adodb.stream
st.type=text
st.open
Me.CommonDialog1.Filter = "txt文件(*.txt)|*.txt"
Me.CommonDialog1.ShowOpen
filepath = Me.CommonDialog1.FileName
If filepath <> "" Then
stream1.LoadFromFile filepath
me.text1 = stream1.Read
If Err.Number <> 0 Then
MsgBox "successful to save image!"
Else
MsgBox Err.Number & ":" & Err.Description
End If