VB文件打开的代码纠错

来源:百度知道 编辑:UC知道 时间:2024/06/09 12:53:06
CommonDialog1.Filter = "TXT文件|*.txt"
CommonDialog1.ShowOpen
If CommonDialog1.FileName <> "" Then
Shell CommonDialog1.FileName
End If
试过,为什么不行

CommonDialog1.Filter = "TXT文件|*.txt"
CommonDialog1.ShowOpen
If CommonDialog1.FileName <> "" Then
open CommonDialog1.FileName for input as #1
text1.text=StrConv(InputB(LOF(1), #1), vbUnicode)
colse 1
End If

Shell 只可以执行EXE程序

改为 Shell "notepad.exe " & CommonDialog1.FileName

文件需要相应的程序来打开
或者使用WinAPI,ShellExecute