那要看是什么文件,还有你要打开的方式。假定该文件名为:"abc.txt"如果是普通文件,用它的标准方式打开的话: 声明: 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 使用: ShellExecute 0,"Open",app.path & "\abc.txt","","",vbNormalFocus
声明:
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
使用:
ShellExecute 0,"Open",app.path & "\abc.txt","","",vbNormalFocus
或则 shellexecute me.hwnd,"Open",filepath/filename,vbnullstring,vbnullstring,SW_SHOWNORMAL