|
|
This function uses the MSXML HTTP Request class and scrapes the html content from the specified web page/query and returns the results in a VBA string. Example Usage: CODE ' WebpageToString ' http://www.utteraccess.com/wiki/index.php/WebpageToString ' Code courtesy of UtterAccess Wiki ' Licensed under Creative Commons License ' http://creativecommons.org/licenses/by-sa/3.0/ ' ' You are free to use this code in any application, ' provided this notice is left unchanged. ' ' rev date brief descripton ' 1.0 2012-01-17 ' Public Function WebpageToString(ByVal srcURL As String) As String 'return a string of the specified URL source 'prelim version, no validations On Error Resume Next Dim xhr As Object Set xhr = CreateObject("Microsoft.XMLHTTP") xhr.Open "GET", srcURL, False xhr.Send WebpageToString = xhr.responsetext Set xhr = Nothing If Err.Number <> 0 Then WebpageToString = "" End If End Function
|
| This page was last modified 10:49, 17 January 2012. This page has been accessed 84 times. Disclaimers |