retrieve data from web

  • Thread starter Thread starter mamuka34
  • Start date Start date
M

mamuka34

Hi,
I have problem to write macro
I want to retrieve data from web. can anyone help me with this?
please........
 
data>import external data>new >put your url in the address line>pick tables
(or whole page)>import
 
VBA demo for importing a webpage into Excel
(This will import this discussion into Excel. Not very pretty, but
good enough to extract any desired data out of the imported web page)

Private Sub Webpageimportexample()
Dim uri As String
Dim ws As Worksheet
uri = "URL;" & "http://groups.google.com/group/
microsoft.public.excel.programming/browse_thread/thread/
f39346eab6de8d55?hl=en"
Err.Clear
Set ws = Worksheets.Add
With ws.QueryTables.Add(Connection:=uri,
Destination:=ws.Range("A1"))
.Refresh (False)
End With
err_num = Err.Number
If err_num <> 0 Then
If err_num = 1004 Then
x = MsgBox("no connection", vbCritical, "web page
retrieval")
Else
x = MsgBox("Error while updating: " + CStr(err_num),
vbCritical, "web page retrieval")
End If
End If
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top