Updating from internet
Sorry for posting lots of times - don't want anyone to be trying to
solve a problem for me that is no longer a problem!
I now have the code below working;
Sub THISONE()
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
' Select and copy all of the data from the web page
IE.ExecWB OLECMDID_SELECTALL, OLECMDEXECOPT_DONTPROMPTUSER
IE.ExecWB OLECMDID_COPY, OLECMDEXECOPT_DODEFAULT
' Close the internet explorer application
IE.Quit
'Sheets("sheet2").Activate
Range("B25").Select
ActiveSheet.PasteSpecial Format:="Unicode Text", link:=False, _
DisplayAsIcon:=False
End Sub
However
1. The paste special errors Run Time error 1004, PasteSpecial Method
of Worksheet class failed. If I paste manually into a cell (using
paste special or just Ctrl & V it works fine)
2. I now need the code to run every 5 minutes from when it is started
until it is stopped.
3. I need to do some error handling incase there is no internet
connection. I am not sure how to word this is the code.
|