'向大家介绍一个已经对象化好的 ShellExecute '引用 Microsoft Windows Script Host Object Model Dim x As New IWshRuntimeLibrary.IWshShell_Class x.Run "d:\恶意.txt" x.Run "d:\northwind.mdb" x.Run "http://www.playyuer.com"
声明API 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 Me.hwnd, "Open", "filename.mdb", "", App.Path, 1
'引用 Microsoft Windows Script Host Object Model
Dim x As New IWshRuntimeLibrary.IWshShell_Class
x.Run "d:\恶意.txt"
x.Run "d:\northwind.mdb"
x.Run "http://www.playyuer.com"
这个东西用于.txt是可以的
为什么不能打开.mdb数据库?!
这样才对的
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 Me.hwnd, "Open", "filename.mdb", "", App.Path, 1
这种方法适合于任何文件的打开!
Call Shell("D:\Program Files\Microsoft Office\Office\Msaccess.exe E:\data\main.mdb ", vbNormalFocus)