Results 1 to 7 of 7

Thread: [RESOLVED] VBA downloading source from internet

  1. #1

    Thread Starter
    New Member
    Join Date
    Oct 2006
    Posts
    14

    Resolved [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

  2. #2
    Frenzied Member SeanK's Avatar
    Join Date
    May 2002
    Location
    Boston MA
    Posts
    1,160

    Re: VBA downloading source from internet

    I think that control is only available in VB6, not through VBA.
    Beantown Boy
    Please use [highlight=vb]your code goes in here[/highlight] tags when posting code.
    When you have received an answer to your question, please mark it as resolved using the Thread Tools menu.

  3. #3

    Thread Starter
    New Member
    Join Date
    Oct 2006
    Posts
    14

    Re: VBA downloading source from internet

    Do you know another way to download source off the internet?

  4. #4
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    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

  5. #5

    Thread Starter
    New Member
    Join Date
    Oct 2006
    Posts
    14

    Re: VBA downloading source from internet

    Does anyone know how to get a xml of a website using vba

  6. #6
    Fanatic Member VBAhack's Avatar
    Join Date
    Dec 2004
    Location
    Sector 000
    Posts
    617

    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:
    1. Private Function GetWebPage(ByRef URL As String) As String
    2.     Dim xml As IXMLHTTPRequest
    3.     On Error Resume Next
    4.     Set xml = CreateObject("Microsoft.XMLHTTP")
    5.     With xml
    6.         .Open "GET", URL, False
    7.         .send
    8.         GetWebPage = .responseText
    9.     End With
    10.     Set xml = Nothing
    11. 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
    Last edited by VBAhack; Oct 17th, 2006 at 03:21 PM.

  7. #7

    Thread Starter
    New Member
    Join Date
    Oct 2006
    Posts
    14

    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:
    1. Sub getXML(xmlPath As String)
    2.   Dim HttpReq As New MSXML2.XMLHTTP40
    3.   HttpReq.Open "GET", xmlPath, False
    4.   HttpReq.Send
    5.   MsgBox HttpReq.ResponseText
    6. End Sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width