给你提供一个方式
要加commondialog控件
private sub command1_click()
dim strs,sinput as string
commondialog1.filter="文本文件(*.txt)|*.txt|所有文件(*.*)|*.*|"
commondialog1.showopen
commondialog1.cancelerror=false
text1.text=commondialog1.filename
inputtext.text=""
open commondialog1.filter for input as #1
do while not eof(1)
line input strs,#1
inputtext.text=inputtext.text+strs+vbcrlf
sinput=inputtext.text
loop
close #1
msgbox "读取数据成功", ,"提示"
end sub
[此贴子已经被作者于2021-12-14 11:35编辑过]