copying an asp page to excel

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am regularly downloading an asp web page and what I want to do is to do it automatically

The web page consists of one main page and many linked pages to it. Firstly I am selecting the whole page and copying it to an excel worksheet afterwards I click on each (there are many) link on the web page and doing the same process once again (selecting it copying it to excel). The links on the page are on the same column but the number of them changes from day to day. The linked pages may consist of one or more pages

I would be grateful if you could help me in this very much time consuming job.
 
Hi Hakan,

I think you are a lucky person, yesterday Bradley did send in some code.

Because I did not before use the technique he was using I did take a look,
it did work fine, I optimezed it a little bit and here is what I made from
it. You can take a try if it works for you.

Do you think this code will fix your problem?

Option Strict On
Imports System.IO
Imports System.Net
Imports System.Text


Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
txtURL.Text = "http://xxx.xxx.xxx"
End Sub
Private Sub btnGetSource_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnGetSource.Click
Dim WebPageSource As Stream
Dim WebPageSourceText As StreamReader
Dim myUri As New Uri(txtURL.Text)
Try
Dim WebPage As WebRequest = WebRequest.Create(myUri)
Dim WebPageText As WebResponse = WebPage.GetResponse()
WebPageSource = WebPageText.GetResponseStream
WebPageSourceText = New StreamReader(WebPageSource,
System.Text.Encoding.ASCII)
txtPageSource.Text = WebPageSourceText.ReadToEnd()
Catch ex As Exception
MsgBox("Invalid URL or page not available error: " & ex.ToString)
Exit Sub
End Try
End Sub


I hope this helps a little bit?

Cor
 
Back
Top