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 Form_Load() ShellExecute hwnd, "open", "http://www.baidu.com", "", "", 1 End Sub
为什么在form_load里就行,写在按钮里就不行呢?挺怪!
shell "cmd /c explorer http://www.google.com.hk
随便写下的,你写在sub main里都可以。
Explorer.exe 本身就是以默认的方式打开文件的Option Explicit Private Sub Command1_Click() Dim ie As Object Set ie = CreateObject("INTERNETEXPLORER.APPLICATION") ie.Visible = True ie.Navigate "http://CBM666.NET/" 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 LongPrivate Sub Form_Load()
ShellExecute hwnd, "open", "http://www.baidu.com", "", "", 1
End Sub
为什么在form_load里就行,写在按钮里就不行呢?挺怪!
shell "cmd /c explorer http://www.google.com.hk
Private Sub Command1_Click()
Dim ie As Object
Set ie = CreateObject("INTERNETEXPLORER.APPLICATION")
ie.Visible = True
ie.Navigate "http://CBM666.NET/"
End Sub