Launch browser and pass URL string

fitchic77
06-22-2001, 09:23 AM
I am a VBA newbie and I need to launch Microsoft Internet Explorer and pass (i.e.) http://www.yahoo.com to it.

Any help would be greatly appreciated.

THANKS!!
:)

Mill
06-22-2001, 09:39 AM
Do a search for the ShellExecute function on here. It will let you pass a url (or any file with a known extension like .txt, .doc, etc.) to it and it will load the default application for running that file type. In this case, .html files would be loaded with Internet Explorer.

DDD
06-26-2001, 10:51 AM
Or you can use WINAPI function -

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_SHOWMAXIMIZED As Long = 3

Public Sub GoToTheWeb()
Call ShellExecute(0, "open", "http:\\www.yahoo.com", "", "", SW_SHOWMAXIMIZED)
End Sub

basicvisual
10-27-2001, 02:06 AM
hey i had the same question about how to launch apps like Internet Explorer from my VBA code. I tried your sample code and it worked perfectly.

My problem is that I don't really understand why your code worked. Would someone who can explain the process of why this code worked please post it?

Mill
10-29-2001, 06:23 AM
Let's say that you open up Windows Explorer and then double-click on a file. Depending on the extension of that file (.txt, .html, .doc, etc), Windows will use a different program to open the file. ShellExecute is an API function that does that through code.

Look at this tutorial by PWNettle (http://www.visualbasicforum.com/bbs/showflat.php?Cat=&Board=tu&Number=30828&page=0&view=collapsed&sb=5&o=a ll&fpart=) for more information.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum