以下代码打开一个指定文件,如果该文件不存在,为了不使程序出错,需要加个Error程序,可我才学了一星期还不会,请各位高手帮帮忙,帮我加上
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
Private Sub Command1_Click()
Dim sFile As String
sFile = Dir("c:\1111\a.URP")
ShellExecute Me.hwnd, "open", "c:\1111\" & sFile, "", "", vbNormalFocus
sFile = Dir
End Sub
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
Private Sub Command1_Click()
Dim sFile As String
sFile = Dir("c:\1111\a.URP")
ShellExecute Me.hwnd, "open", "c:\1111\" & sFile, "", "", vbNormalFocus
sFile = Dir
End Sub