Thread: Navigation
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bernie Deitrick Bernie Deitrick is offline
external usenet poster
 
Posts: 5,441
Default Navigation

Below is some example code. CCCC is the name of a input box on that page....

HTH,
Bernie
MS Excel MVP


Sub GETTAF()
Dim IE
Dim IPF

' Prepare to open the web page
Set IE = CreateObject("InternetExplorer.Application")

With IE
.Visible = True
.Navigate "http://weather.noaa.gov/weather/shorttaf.shtml"

' Loop until the page is fully loaded
Do Until Not .Busy
DoEvents
Loop

' Make the desired selections on the web page and click the submitButton
Set IPF = IE.Document.all.Item("CCCC")
IPF.Value = "LEVC"
Set IPF = IE.Document.all.Item("SUBMIT")
IPF.Value = "submit"
IPF.Click

' Loop until the page is fully loaded
Do Until Not .Busy
DoEvents
Loop

End With
Sheets("sheet1").Cells(1, "A").Value = IE.Document.body.innerText

' Close the internet explorer application
With IE
.Visible = True
End With

IE.Quit

End Sub


"bodhisatvaofboogie" wrote in message
...
New to automating some IE navigation within excel VBE, I've searched a
variety of forums already, and found little code example for navigating web
pages I just need a little boost.

The following code works great for opening a webpage automatically. IN this
example, it opens Mapquest. However, I have no idea how to set the code to
select variuos things on the web page and enter data, etc. Could someone
provide an example of how to enter some data into this webpage in the map
section and have it select the get map option? I can work off of that and
modify to suit my needs, I just need a tiny example of some web page
navigation, selecting things on a web page, etc, so I can see what the code
looks like. THANKS!!!!!

Dim IE As InternetExplorer
Set IE = New InternetExplorer

IE.Navigate URL:="http://www.mapquest.com/"
IE.Visible = True
Do While IE.Busy Or Not IE.ReadyState = _
READYSTATE_COMPLETE
DoEvents
Loop
MsgBox IE.Document.body.innerText
IE.Quit
Set IE = Nothing