[RESOLVED] VBA downloading source from internet
Hi everyone
I have a problem. I am creating a modual in vba to get source code from the internet. The file is a xml file.
I wanted to use Microsoft Internet Transfer Control 6.0 but vba won’t let me use it because it isn’t correctly licensed even though i have registered it with regsur32.
I was wondering if there was another way. So any suggestions would be appreciated
Re: VBA downloading source from internet
I think that control is only available in VB6, not through VBA.
Re: VBA downloading source from internet
Do you know another way to download source off the internet?
Re: VBA downloading source from internet
Quote:
Originally Posted by daywalker
Do you know another way to download source off the internet?
Not using VBA, but, the VBA people probably do. :)
Moved to Office Development
Re: VBA downloading source from internet
Does anyone know how to get a xml of a website using vba
Re: VBA downloading source from internet
I've used HTTPRequest w/ VBA (need reference to Microsoft XML or Microsoft Internet Controls I don't remember which) to download source:
VB Code:
Private Function GetWebPage(ByRef URL As String) As String
Dim xml As IXMLHTTPRequest
On Error Resume Next
Set xml = CreateObject("Microsoft.XMLHTTP")
With xml
.Open "GET", URL, False
.send
GetWebPage = .responseText
End With
Set xml = Nothing
End Function
Also used the following Win API function w/ VBA to download source to a text file:
http://www.allapi.net/apilist/URLDownloadToFile.shtml
Re: VBA downloading source from internet
Thanks VBAhack for pointing me in the right dirrection.
This is how I finally did it
(needs reference to Microsoft XML v4.0)
VB Code:
Sub getXML(xmlPath As String)
Dim HttpReq As New MSXML2.XMLHTTP40
HttpReq.Open "GET", xmlPath, False
HttpReq.Send
MsgBox HttpReq.ResponseText
End Sub