Hi All
Is there a way to grab specific data from websites using VBA in MS Access. Will using SendKeys help?
Hi All
Is there a way to grab specific data from websites using VBA in MS Access. Will using SendKeys help?
I found this code on the web somewhere a while ago, and use it on the few databases that I have that get webpages...
[VBA]
'***** Begin of Code *******
'***
'***
'*** Call: a = Fetch("http://www.google.com","c:\google.html")
'***
'*** return TRUE on success
'*** DOES NOT WORK
Public Function Fetch(URL, dest)
'On Error Resume Next
Dim b
Err.Clear
With CreateObject("Microsoft.XMLHTTP")
.Open "GET", URL, False
.send
b = .responseBody
If Err.Number <> 0 Or .Status <> 200 Then
Fetch = False
Exit Function
End If
End With
With CreateObject("ADODB.Stream")
.Type = 1
.Open
.Write b
.SaveToFile dest, 2
End With
Fetch = Err.Number = 0
End Function
'****** end of code *****
[/VBA]
That will fetch the entire webpage.. then you can parse it how you need to.
GComyn
For 'specific' data, you probably have to be more specific. If it's table data Excel has built-in methods under the Data menu and you can transfer to Access.Originally Posted by Jeevie
Assuming you are using IE, either an HTTP request, or direct web scraping using IE functions will get what you want. If you are attempting to fill table rows, for example, stock prices - web scraping is probably preferable, unless data can be obtained as XML or JSON in which case there are other tools to process those.