+ Reply to Thread
Results 1 to 3 of 3

Open (website) for Input?

  1. #1
    Joey Lichtenstein
    Guest

    Open (website) for Input?


    I know how to do the basic:

    open "c:\file.txt" for Input As #1

    is it possible to open a web site for text input, and read the html code
    as text into VBA? What would the format for the filename be?

    Thanks so much in advance!

    Joey


  2. #2
    Tim Williams
    Guest

    Re: Open (website) for Input?

    Function GetSource(sURL) As String


    Dim xmlhttp As Object
    Set xmlhttp = CreateObject("Microsoft.XMLHTTP")


    onerror goto haveError

    xmlhttp.Open "GET", sURL, False
    xmlhttp.send
    GetSource = xmlhttp.responseText
    Exit Function
    haveError:
    GetSource = "Error: " & Err.Description
    End Function


    Sub test()
    MsgBox GetSource("http://www.google.com")
    End Sub


    Tim



    "Joey Lichtenstein" <[email protected]> wrote in message
    news:[email protected]...
    >
    > I know how to do the basic:
    >
    > open "c:\file.txt" for Input As #1
    >
    > is it possible to open a web site for text input, and read the html code
    > as text into VBA? What would the format for the filename be?
    >
    > Thanks so much in advance!
    >
    > Joey
    >




  3. #3
    Joey Lichtenstein
    Guest

    Re: Open (website) for Input?

    Thanks Tim!

    This Works PERFECT!!!!

    Tim Williams <timjwilliams at gmail dot com> wrote:


    : Function GetSource(sURL) As String


    : Dim xmlhttp As Object
    : Set xmlhttp = CreateObject("Microsoft.XMLHTTP")


    : onerror goto haveError

    : xmlhttp.Open "GET", sURL, False
    : xmlhttp.send
    : GetSource = xmlhttp.responseText
    : Exit Function
    : haveError:
    : GetSource = "Error: " & Err.Description
    : End Function


    : Sub test()
    : MsgBox GetSource("http://www.google.com")
    : End Sub


    : Tim



    : "Joey Lichtenstein" <[email protected]> wrote in message
    : news:[email protected]...
    :>
    :> I know how to do the basic:
    :>
    :> open "c:\file.txt" for Input As #1
    :>
    :> is it possible to open a web site for text input, and read the html code
    :> as text into VBA? What would the format for the filename be?
    :>
    :> Thanks so much in advance!
    :>
    :> Joey
    :>



+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1