有如下几种方法:
1. 用 Shell 语句:
Shell "C:\Windows\CALC.exe", vbNormalFocus
2. 用API函数ShellExecute():' 浏览器访问及执行文件
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 LongPrivate Sub cmdShellExec_Click()
'启动程序或打开页面
On Error Resume Next
Dim Dummy As Long
Dim ShellPathName As String
ShellPathName = "C:\Windows\Calc.exe"
Dummy = ShellExecute(0&, vbNullString, ShellPathName, vbNullString, vbNullString, vbNormalFocus)
End Sub
1. 用 Shell 语句:
Shell "C:\Windows\CALC.exe", vbNormalFocus
2. 用API函数ShellExecute():' 浏览器访问及执行文件
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 LongPrivate Sub cmdShellExec_Click()
'启动程序或打开页面
On Error Resume Next
Dim Dummy As Long
Dim ShellPathName As String
ShellPathName = "C:\Windows\Calc.exe"
Dummy = ShellExecute(0&, vbNullString, ShellPathName, vbNullString, vbNullString, vbNormalFocus)
End Sub
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货