您可以使用Windows API函数ShellExecute来执行此操作:
Option Explicit
Private Declare Function ShellExecute _
Lib "shell32.dll" Alias "ShellExecuteA" ( _
ByVal hWnd As Long, _
ByVal Operation As String, _
ByVal Filename As String, _
Optional ByVal Parameters As String, _
Optional ByVal Directory As String, _
Optional ByVal WindowStyle As Long = vbMinimizedFocus _
) As Long
Public Sub OpenUrl()
Dim lSuccess As Long
lSuccess = ShellExecute(0, "Open", "www.google.com")
End Sub
关于安全性的简短说明:如果URL来自用户输入,请确保严格验证该输入,因为ShellExecute将执行具有用户权限的任何命令,如果用户是管理员,则将执行格式c:。