Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Open browser from excel

Is it possible to open a new instance of internet explorer with a command
button and pass it an address from an text box in excel? If so, can someone
please give an example of syntax?


TIA,
nivek


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 860
Default Open browser from excel

Hi nivek,

Yes. When the CommandButton "cmdGo" is clicked, the following code will
open an IE window and navigate to the URL entered in the TextBox "txtURL":

Private Sub cmdGo_Click()
On Error GoTo ErrHandler

ThisWorkbook.FollowHyperlink txtURL.Text

ExitRoutine:
Exit Sub
ErrHandler:
MsgBox "Invalid URL. Please try again.", _
vbExclamation, "Invalid URL"
Resume ExitRoutine
End Sub


Enter this code in the code behind the Worksheet which contains your
controls. To do that, just right-click the sheet tab and select View Code,
then copy/paste this code into the code window.


--
Regards,

Jake Marx
MS MVP - Excel
www.longhead.com

[please keep replies in the newsgroup - email address unmonitored]


nivek wrote:
Is it possible to open a new instance of internet explorer with a
command button and pass it an address from an text box in excel? If
so, can someone please give an example of syntax?


TIA,
nivek


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Open browser from excel

from Posts by Jake Marx

If you go to the VBE and select Tools | References, look for Microsoft
Internet Controls and check the box next to it. That will allow Excel to
use the necessary library for the code to work as written.

Sub test23()
Dim ie As InternetExplorer

Set ie = New InternetExplorer

ie.Navigate URL:="http://www.longhead.com/"

Do While ie.Busy Or Not ie.ReadyState = _
READYSTATE_COMPLETE
DoEvents
Loop

MsgBox ie.Document.body.innertext

ie.Quit
Set ie = Nothing
End Sub

--
Regards,
Tom Ogilvy

"nivek" wrote in message
...
Is it possible to open a new instance of internet explorer with a command
button and pass it an address from an text box in excel? If so, can

someone
please give an example of syntax?


TIA,
nivek




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Open Excel not in a browser JS82 Excel Discussion (Misc queries) 1 March 30th 07 02:42 PM
excel can not open on some IE browser Faiz Excel Discussion (Misc queries) 3 July 20th 06 01:29 PM
Excel cannot open while web browser opened soundbug Excel Discussion (Misc queries) 0 April 27th 06 06:18 AM
Open Excel in a browser without changing URL 54patman Excel Discussion (Misc queries) 1 August 15th 05 04:09 PM
Open excel in browser no menu options SusanN Excel Discussion (Misc queries) 1 May 26th 05 05:18 AM


All times are GMT +1. The time now is 02:40 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"