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

Hi,

I am sure there is a way to do this but do not know where to start!
I want an excel sheet to update some cells from different values on
different websites every x amount of minutes.

If somebody could point me towards somewhere with some instructions
that would be great.

Thanks,

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default Updating from internet

Keri,
DataImport External DataNew Web Query

NickHK

"keri" wrote in message
oups.com...
Hi,

I am sure there is a way to do this but do not know where to start!
I want an excel sheet to update some cells from different values on
different websites every x amount of minutes.

If somebody could point me towards somewhere with some instructions
that would be great.

Thanks,



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 34
Default Updating from internet

Thanks. However I do not know if this is the solution to my problem so
I will explain further.

Currently I have VBA that opens a web page, and using sendkeys submits
data to the page to open another page. It is on this second page that
I automatically want the code to copy some information back into
excel, then close the web page. I can see that the web query works but
can I put this query into my code or is there another way of coding it?

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 34
Default Updating from internet

Currently I am using this code;

Sub gettaf()
ActiveWorkbook.FollowHyperlink _
Address:="http://weather.noaa.gov/weather/shorttaf.shtml"
Application.Wait (Now + TimeValue("0:00:15"))

SendKeys "{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB }{TAB}{TAB}
{TAB}{tab}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB} {TAB}", True
SendKeys "LEVC", True
SendKeys "~"
Application.Wait (Now + TimeValue("0:00:5"))

MsgBox "Done"

End Sub

Which opens the web page, uses send keys to enter the value required
and submits. I then need to get the data off the next page that is
opened after submitting.

All of the threads I have read use code like below;

Sub gettaf2()

' 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

End Sub

However this does not work for me because;
1. I am unsure if I am putting the correct names and values of the
items as the page does not enter the value and submit. Some of the
source code is below;

<br<br
<form name="textbox" method="post" action="/cgi-bin/
mgetstaf.pl"<INPUT TYPE="TEXT"
NAME="cccc" SIZE="20" ALIGN="MIDDLE" <BR<INPUT TYPE="SUBMIT"
NAME="Submit"
VALUE="SUBMIT" ALIGN="MIDDLE"
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<INPUT TYPE="RESET" NAME="Clear" VALUE="CLEAR" ALIGN="MIDDLE"
</form

2. I am unsure what IPF is - and my computer seems to be unsure also -
it does not recognise it.

For info I have references set to Microsoft Internet Controls, HTML
Object Library and XL, v5.0

Thanks,

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 34
Default 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.

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
XLT and Internet Emece Excel Discussion (Misc queries) 6 April 6th 10 03:56 PM
VBA and internet dr chuck Excel Programming 1 November 26th 06 05:03 PM
Help with updating query table from internet Les Stout[_2_] Excel Programming 0 April 25th 06 09:22 AM
Updating Excel spreadsheets over the Internet? Dan Merkel Excel Discussion (Misc queries) 1 May 20th 05 04:44 PM
When updating a worksheet, how do I create a link updating the sa. Phlashh Excel Worksheet Functions 9 January 27th 05 06:05 PM


All times are GMT +1. The time now is 03:34 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"