Web Browser

I'm afraid this is probably a rather stupid question, but I simply want to be able to launch a web browser (IE, whatever) in a new window.  You all mention a web browser control, but I'm just not sure where to get this/how to make this.  Thanks for your help!
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

'open a browser and go to a www address
'bas module
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

Function ShellToBrowser%(Frm As Form, ByVal URL$, ByVal WindowStyle%)
    Dim api%
        api% = ShellExecute(Frm.hwnd, "open", URL$, "", App.Path, WindowStyle%)
    'Check return value
    If api% < 31 Then
        'error code - see api help for more info
        Dim msg As String
        msg = "This item doesn't work with your system"
        MsgBox msg, vbCritical, "Error"
        ShellToBrowser% = False
    ElseIf api% = 32 Then
        'no file association
        Dim msg1 As String
        msg1 = "This item doesn't work with your system"
        MsgBox msg, vbCritical, "Error"
        ShellToBrowser% = False
        'It worked!
        ShellToBrowser% = True
    End If
End Function

'<<<  event from application...click event of button  >>>>>>>>
Private Sub cmdWeb_Click()
    Dim Site As String
    Dim success As Integer
        Site = "http://www.Yahoo.com/" '& Trim(txtWeb.Text)
        success% = ShellToBrowser(Me, Site, 0)
End Sub


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
kataragonAuthor Commented:
Wow Juilette, thanks for the quick response.  But could you explain to me what the use of the % means, and how/why success is able to change to success% ?
Also, if I already have a window open, it just replaces the page I had.  Is there a way to get it to open in a new window?

Thanks again
% indicates a variable type. Long, I think.
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

kataragonAuthor Commented:
Yeah, I figured as much.  Thanks.

But does anyone know how to get the page to open up a new instance of the browser?

I've never used ShellExecute, but I would try changing the second param from "open" to "opennew". If ShellExecute works the way I think it does, then I am right, if not, then...
kataragonAuthor Commented:
Thanks all- FYI, no, ShellExecute doesn't work with an 'opennew'.  I found some info on it, http://msdn.microsoft.com/library/periodic/period99/vji9904_shell.htm

And I decided I guess I can just open a new instance of IE myself, then run Juilette's code from up top.  

Thanks for all your help!

kataragonAuthor Commented:
Oh, I said this was a 10 point question, but now why is it showing up '1 point'?  Did I miss something?
Thanks for the info on ShellExecute.

The point value is correct. Once an answer has been accepted, the points are divided by 10. Now others can get the answer by "buying" the PAQ. I suspect the amount is shrunk because the new looker doesn't know if the answer is definitely what they want.

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.