Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 49
Default Getting data from the Internet

Hi,
I have never done this so this is a new adventure for me. This is more of a
question of where I can get more information about this sort of problem, as I
can see several other jobs requiring this coming up in the near future

1. Start IE/Firefox
2. I need to log on to the web site
3. I need to fill out the search query and press the button for it
4. Copy the data from the web page to a spread sheet
5. If there is another page of data, select the next page and repeat 3
6. Log off from the web site
7. Shut down IE/Firefox

If you could direct me to somewhere I could find out how to do this that
would be great

MarkS
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Getting data from the Internet

There isn't a lot of good information on downloading from the Internet. Each
webpage is different. To downlod web data I use a combination of lots of
different methods and a lot of experience from worksing with lot of webpages
to successuflly acommplish this task. I can help but without a account and
password at the sight it is going to take a lot instruction. If yo get me
the URL I can get your through the login menu without actually having the
password. I will give you generic code and you can modifed the code to put
oin the correct account and password. but then I won't have access to the
remaining pages.

I often look at the source HTML code to help me. going to the webo browser
and using the menu view - Source gets me the HTML code. Also dumping the
data to the worksheet also helps using the macro below.

The login webpage is usually a form.
To get a form or any other tag use this instruction
Set Form = IE.document.getElementsByTagname("Form")

Tags in the htmp source are the string following the angle brackets

<abc 'the html data here /abc
or
<abc 'the html data here /


the end tag may be just the angle bracket or a forward sla and angle brackt
without the tagname.

To get "id=" items from the html us this instruction. Look at source html
code for the string "id="
Set zip5 = IE.document.getElementById("zip5")

Both of the above formats return multiple occurances of each item. You can
access each item returned by using a for look
for each itm = form

next itm

The items are also an array starting at index 0. So you can get the 3rd
"form" using this instruction

Set Myform = form(2) assuming you used getElementsByTagname method above.


Try this code

Sub GetZipCodes()


ZIPCODE = InputBox("Enter 5 digit zipcode : ")

Set IE = CreateObject("InternetExplorer.Application")
IE.Visible = True

URL = "http://zip4.usps.com/zip4/citytown_zip.jsp"

'get web page
IE.Navigate2 URL
Do While IE.readyState < 4 or
While IE.busy = True

DoEvents
Loop

Set Form = IE.document.getElementsByTagname("Form")

Set zip5 = IE.document.getElementById("zip5")
zip5.Value = ZIPCODE


Set ZipCodebutton = Form(0).onsubmit

Form(0).submit
Do While IE.busy = True
DoEvents
Loop

Set Table = IE.document.getElementsByTagname("Table")
Location = Table(0).Rows(2).innertext
IE.Quit
MsgBox ("Zip code = " & ZIPCODE & " City/State = " & Location)

'test code for dumpling worksheet
RowCount = 1
for each itm in IE.document.all
Range("A" & rowcount) = itm.tagname
Range("B" & rowcount) = itm.classname
Range("C" & rowcount) = left(itm.innertgext,1024) 'filter data to
prevent

'memory errors


RowCount = RowCount + 1
next itm

End Sub



"MarkS" wrote:

Hi,
I have never done this so this is a new adventure for me. This is more of a
question of where I can get more information about this sort of problem, as I
can see several other jobs requiring this coming up in the near future

1. Start IE/Firefox
2. I need to log on to the web site
3. I need to fill out the search query and press the button for it
4. Copy the data from the web page to a spread sheet
5. If there is another page of data, select the next page and repeat 3
6. Log off from the web site
7. Shut down IE/Firefox

If you could direct me to somewhere I could find out how to do this that
would be great

MarkS

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 49
Default Getting data from the Internet



"Joel" wrote:

There isn't a lot of good information on downloading from the Internet. Each
webpage is different. To downlod web data I use a combination of lots of
different methods and a lot of experience from worksing with lot of webpages
to successuflly acommplish this task. I can help but without a account and
password at the sight it is going to take a lot instruction. If yo get me
the URL I can get your through the login menu without actually having the
password. I will give you generic code and you can modifed the code to put
oin the correct account and password. but then I won't have access to the
remaining pages.

I often look at the source HTML code to help me. going to the webo browser
and using the menu view - Source gets me the HTML code. Also dumping the
data to the worksheet also helps using the macro below.


The URL is http://d-cyphatrade.com.au/
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
Linking data from the Internet Doug Sanders Excel Worksheet Functions 3 January 6th 10 06:22 AM
update data from internet willemeulen[_34_] Excel Worksheet Functions 2 June 8th 09 02:28 PM
Using VBA to access data via the Internet JeremyJ Excel Programming 3 January 12th 09 11:28 PM
Internet data retrival filo666 Excel Programming 1 July 11th 07 04:46 PM
Get data from Internet? XML? QUERY? HotRod Excel Programming 0 May 9th 07 04:20 PM


All times are GMT +1. The time now is 10:19 AM.

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"