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
Declare Function GetDesktopWindow Lib "user32" () As Long'文件调用函数
sub nRunFile(strFileName As String) 
  Dim Scr_hDC,nRunRet As Long
  Scr_hDC = GetDesktopWindow()
  
  nRunRet= ShellExecute(Scr_hDC, "Open", strFileName, "", "", 1)
  If nRunRet= 31 Or StartDoc = 2 Then MsgBox "无法打开指定文件!", vbOKOnly + vbExclamation
End subsub button1_click()
  dim strNamex as string  strNamex="c:\myFiles\filex1.txt"
  nRunRet strNamex
end sub