How to fetch the table from ASP web site and save in Excel

rajen87

New member
Joined
Jan 1, 2012
Messages
1
Reaction score
0
Points
0
We have a search tool web site (.aspx), which will give the list of policy data in a table format (Rows & Columns) upon clicking submit button. i want to fetch the entire table and have to save that in a excel. I have already wrote the code for opening the web site and clicking submit botton. I have the source code of the web site,please let me know if you want i will mail you. Can anyone give me the sample code to fetch the entire 12th table of the web site and save it in the excel worksheet. Thanks for your help.


Please remember that, i have to include your sample in the below query. So please provide the code which fit into this.


Code:
Sub Button1_Click() 
Dim obj As Object 
Dim Scrn As String 
Dim objIE As SHDocVw.InternetExplorer 'microsoft internet controls (shdocvw.dll) 
Dim htmlDoc As MSHTML.HTMLDocument 'Microsoft HTML Object Library 
Dim htmlInput As MSHTML.HTMLInputElement 
Dim htmlColl As MSHTML.IHTMLElementCollection 


Set objIE = New SHDocVw.InternetExplorer


If (objIE Is Nothing) Then 
MsgBox "Could not create the Internet Explorer object. Stopping macro playback." 
Stop 
End If 


With objIE 
.Navigate "link" ' Main page


.Visible = 1 
Do While .readyState <> 4: DoEvents: Loop 
Application.Wait (Now + TimeValue("0:00:02"))
Set htmlDoc = .document 
objIE.document.getElementById("LOBList").Value = "A" 
objIE.document.getElementById("DataFilterEnv").Value = "L" 
objIE.document.getElementById("ctl04_rdbAutoTransitionSignal_1").Checked = True objIE.document.getElementById("ctl04_AutoTransitionSignal").Value = "L" 
objIE.document.getElementById("btnsubmit").Click 


While objIE.Busy 
DoEvents 
Wend 
While objIE.readyState <> 4 
DoEvents 
Wend 


End With 


End Sub
 
Are you still looking for help with this?

It's been a long time since I've done any web scraping, but as long as you have access to the table we should be able to pull out the data.
 
Back
Top