Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default using vb to help with a complex web query

Hey. Ok im trying to use the web query function to pull data off a website...
but to get to specific data I have to click a javascript link that then
changes what is on the webpage, unfortunatly i dont know how to get the
webquery to recognise that im doing this. the page is an asp page and i cant
give you an example link as this page is only avaliable on my works intranet.
is there a way to do this, even with visual basics?

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default using vb to help with a complex web query

You may not be able to do this with a web query. You may need to open an
Internet Explorer application to get the data. Here is an example of doing
this

Sub Getchemicals2()

Found = False
For Each sht In Sheets
If sht.Name = "Chemicals" Then
Found = True
Exit For
End If
Next sht
If Found = False Then
Set ChemicalSht = Sheets.Add(after:=Sheets(Sheets.Count))
ChemicalSht.Name = "Chemicals"
Else
Set ChemicalSht = Sheets("Chemicals")
ChemicalSht.Cells.ClearContents
End If


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

URLFolder = _
"http://www.ilo.org/public/english/protection/safework/cis/products/icsc/dtasht/"
ChemicalRowCount = 1
For Letters = 0 To 25
AlphaLetter = Chr(Asc("a") + Letters)

URL = URLFolder & AlphaLetter & "_index.htm"

'get web page
ie.Navigate2 URL
Do While ie.readyState < 4
DoEvents
Loop

Do While ie.busy = True
DoEvents
Loop

H2Found = False
For Each itm In ie.Document.all
If H2Found = False Then
If itm.tagname = "H2" Then
H2Found = True
End If
Else

If itm.tagname = "A" Then
If itm.innertext = "" Then Exit For

'chemical name
ChemicalSht.Range("A" & ChemicalRowCount) = itm.innertext
'webpage
ChemicalSht.Range("B" & ChemicalRowCount) = itm.href

ChemicalRowCount = ChemicalRowCount + 1
End If
End If
Next itm

Next Letters


End Sub


"full screen problem" wrote:

Hey. Ok im trying to use the web query function to pull data off a website...
but to get to specific data I have to click a javascript link that then
changes what is on the webpage, unfortunatly i dont know how to get the
webquery to recognise that im doing this. the page is an asp page and i cant
give you an example link as this page is only avaliable on my works intranet.
is there a way to do this, even with visual basics?

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
VLOOKUP/MATCH Query - quite complex....but interesting. SAM Excel Discussion (Misc queries) 3 June 29th 09 03:40 PM
Help! with Parameter Query for complex SQL robottv Excel Discussion (Misc queries) 0 April 10th 08 01:58 PM
IF function query (complex) Hammond-Wandsworth Excel Worksheet Functions 3 August 31st 07 03:42 PM
Complex Query Not Able To Get Results in Excel cb22 Excel Programming 2 January 19th 06 01:47 AM
Complex query question Stacy Excel Worksheet Functions 0 June 30th 05 09:50 PM


All times are GMT +1. The time now is 03:41 AM.

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

About Us

"It's about Microsoft Excel"