Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long Const SW_SHOWNORMAL = 1Private Sub Form_Load()
ShellExecute Me.hwnd, vbNullString, "c:\abc\hhh.txt", vbNullString, "", SW_SHOWNORMAL End Sub
ShellExecute Me.hwnd, "open", "C:\1.doc", vbNullString, vbNullString, 1
就可以了
Const SW_SHOWNORMAL = 1Private Sub Form_Load()
ShellExecute Me.hwnd, vbNullString, "c:\abc\hhh.txt", vbNullString, "", SW_SHOWNORMAL
End Sub
Shell "notepad.exe c:\abc\hhh.txt", vbNormalFocus=================================================
还是这个办法省事啊
Shell "notepad.exe " & app.path & "\hhh.txt", vbNormalFocus Path 属性
返回或设置当前路径,即应用程序路径。在设计时是不可用的。对于 App 对象,在运行时是只读的。