access10000
Registered User.
- Local time
- Today, 22:55
- Joined
- May 31, 2007
- Messages
- 25
Hi
I would like to find an efficient and effective way of retrieving text from webpages using VBA in Access, basically a web query. I know this can be done in Excel and have experimented with the code below to do this in Access. I really just need to get the raw data into a file so I can link/import and manipulate it further as needed. If this is dumped as one field that is okay for what I'm after.
The code works fine if you want to know the script behind the webpage etc. but I'm after retrieving data from the page as a user would see it or at least including this.
For example, if I wanted to automatically retrieve prices from a webpage I am after the product description and price, not a load of html code. I have tried various different file formats and at the moment 'xls' is the closest.
Does anyone know of a better method to retrieve just the text as is?
Many thanks
-----------------------------------------------------------------------
'The only ADO or DAO reference present must be "Microsoft DAO 3.6 Object Library"
Option Compare Database
Option Explicit
'Declare function from URLMON.DLL library, installed with Internet Explorer
Private Declare Function URLDownloadToFile Lib "urlmon" Alias _
"URLDownloadToFileA" (ByVal pCaller As Long, ByVal szURL As String, ByVal _
szFileName As String, ByVal dwReserved As Long, ByVal lpfnCB As Long) As Long
Function GetWeb()
Dim PageAddress As String
Dim PageDownLoad As Long
PageAddress = "http://www.access-programmers.co.uk/forums/showthread.php?t=73744"
PageDownLoad = URLDownloadToFile(0, PageAddress, "C:\test.xls", 0, 0)
End Function
I would like to find an efficient and effective way of retrieving text from webpages using VBA in Access, basically a web query. I know this can be done in Excel and have experimented with the code below to do this in Access. I really just need to get the raw data into a file so I can link/import and manipulate it further as needed. If this is dumped as one field that is okay for what I'm after.
The code works fine if you want to know the script behind the webpage etc. but I'm after retrieving data from the page as a user would see it or at least including this.
For example, if I wanted to automatically retrieve prices from a webpage I am after the product description and price, not a load of html code. I have tried various different file formats and at the moment 'xls' is the closest.
Does anyone know of a better method to retrieve just the text as is?
Many thanks
-----------------------------------------------------------------------
'The only ADO or DAO reference present must be "Microsoft DAO 3.6 Object Library"
Option Compare Database
Option Explicit
'Declare function from URLMON.DLL library, installed with Internet Explorer
Private Declare Function URLDownloadToFile Lib "urlmon" Alias _
"URLDownloadToFileA" (ByVal pCaller As Long, ByVal szURL As String, ByVal _
szFileName As String, ByVal dwReserved As Long, ByVal lpfnCB As Long) As Long
Function GetWeb()
Dim PageAddress As String
Dim PageDownLoad As Long
PageAddress = "http://www.access-programmers.co.uk/forums/showthread.php?t=73744"
PageDownLoad = URLDownloadToFile(0, PageAddress, "C:\test.xls", 0, 0)
End Function