第1个回答 2007-12-19
Private Sub Dir1_Click()
File1.Path = Dir1.Path
End Sub
Private Sub Dir1_Change()
File1.Path = Dir1.Path
End Sub
'我的代码程序如下:
Private Sub Drive1_Change()
Dir1.Path = Drive1.Drive
End Sub
Private Sub File1_Click()
File1.Pattern = "*.txt"
End Sub
Private Sub File1_DblClick()
Dim fName As String
fName = File1.Path & "\" & File1.FileName
fName = Replace(fName, "\\", "\")
Shell "notepad " & fName, 1
End Sub本回答被提问者采纳
第2个回答 推荐于2016-10-27
直接打开记事本
Shell "notepad.exe", vbNormalFocus
打开某个txt文件
Shell "notepad.exe c:\文件.txt", vbNormalFocus
后面的vbNormalFocus是打开后窗体的状态,编写代码时会有提示。
第3个回答 2007-12-19
Private Sub File1_DblClick()
'代码太长 我用& _ 格式分了三行 正确应该是把后边的 _ 号去掉 合在一行的
'其中的iif()是以防止返回的File1.Path结尾不是以/或\结束时产生错误的处理
Shell "notepad.exe """ & _
IIf(Right(File1.Path, 1) <> "\" And Right(File1.Path, 1) <> "/", File1.Path & "\", File1.Path) & _
File1.FileName & """""", vbNormalFocus
End Sub
第4个回答 2007-12-19
Shell "notepad.exe " + "?" '? 代表你要打开的文本文件