在VB中想用一个label或一个command 来作 链接,如
Private Sub Label1_Click()
Hyperlink.NavigateTo "http://www.163.net"
End Sub
在运行中却不行的,
出现了{ 要求对象} 的对话框,
我也引用了
microsof internet controls 
microsof html object library
还不行................
这是为什么呢?
用什么方法来解决呢?

解决方案 »

  1.   

    调用下面这个API函数
    Public 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", "http://www.sina.com", vbNullString, vbNullString, 3
      

  2.   

    累吗?楼上的!
    在工程里引用Microsoft Internet Explorer
      

  3.   

    打开浏览器并进入指定网址
     
     声明: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例子:
    Dim ret&
    ret& = ShellExecute(Me.hwnd, "Open", "http://www.163.com", "", App.Path, 1)
    End Sub
    也可以直接发送 Mail,只要把以上的 http 地址换为 "mailto:[email protected]"