WshShell.Run 不能运行快捷方式了
set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run "c:\a.lnk",1
WSHom.Ocx 已经注册过了.....
以下的也不行....怎么回事啊....
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 Const SW_HIDE = 0
Private Const SW_NORMAL = 1
Private Const SW_MAX = 10
Private Const SW_SHOWMAXIMIZED = 3
Private Const SW_SHOWMINIMIZED = 2
Private Const SW_SHOWDEFAULT = 10
Private Sub Command1_Click()
ShellExecute Me.hwnd, "open", "C:\a.lnk", vbNullString, vbNullString, 1
End Sub
[解决办法]
上面我用C:\lin.lnk测试,正常.
Set WshShell = CreateObject("Wscript.Shell")
WshShell.Run "c:\lin.lnk", 1
也正常
我用的文件名是c:\lin.lnk,道理一样