We help IT Professionals succeed at work.

Open a web page in vba

How do i open up a webpage using a command button in vba.  Thanks
Comment
Watch Question

Ryan ChongSoftware Tead Lead / Business Analyst / System Analyst / Data Engineer
CERTIFIED EXPERT

Commented:
Ryan ChongSoftware Tead Lead / Business Analyst / System Analyst / Data Engineer
CERTIFIED EXPERT

Commented:
In Access VBA:

DoCmd.SendObject , , , "Test@test.com", , , "Test", "Hello"
Commented:
Here's a neat way with an api I use.  It will launce IE, or use a session thats already open.  It's kinda like what windows does with associating file types.  For example, if you passed it a .doc file, it would open it in word.


'put this in a global .bas file
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

Public Sub NewShell(cmdLine As String, lngWindowHndl As Long)
   ShellExecute lngWindowHndl, "open", cmdLine, "", "", 1
End Sub



'put this under your button
Public Function cmdIE_Click()

     Dim strIE As String

     strIE = "http://www.yahoo.com"
     Call NewShell(strIE, Me.hwnd)

End Function

Commented:
I'm sorry, I didn't look at ryancys' post.  My bad , it's the same thing.

Explore More ContentExplore courses, solutions, and other research materials related to this topic.