How do you make a browser window open to a specified URL when you click a command button?
Printable View
How do you make a browser window open to a specified URL when you click a command button?
Do you mean the browser active X control?
--Ant
--------------------------------------------------
check out my newest freeware
E-mail me at: [email protected]
for the address
Add a WebBrowser control on your form first. If you can not find the control, add "Microsoft Internet Controls" component into your toolbox.
Then add one text box, one command button on your form.
=========
Private Sub Command1_Click()
On Error Resume Next 'Don't stop execution, continue on next line
WebBrowser1.Navigate Text1.Text
If Err.Number <> 0 Then MsgBox "Error :" & Err.Description 'Display error message
End Sub
========
Regards,
Michi
MCSE, MCDBA
put this in the button click event handler, where URL is the URL string.
ShellExecute(me.hWnd, "Open", URL, "", App.Path, 1)
HTH
cksiow
http://vblib.virtualave.net - share our codes