• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 158
  • Last Modified:

Read a textfile from internet

How do i allow vb to read a text file from a website?

I have a website with tripod.com and i have stored a textfile on there.  I want to be able to read it in vb.  
0
allhailcaesar
Asked:
allhailcaesar
1 Solution
 
DocMCommented:
Use a WebBrowser control
or the InternetExplorer object:

Dim WithEvents IE As InternetExplorer
Private Sub Form_Load()
Set IE = New InternetExplorer
With IE
     .navigate "www.tripod.com/mysite/mytext"
     .Visible = True
End With
End Sub
0
 
BassTeQCommented:
Use the inet control, heres some sample code to get you started

Dim data() As Byte

If Online = False Then
    MsgBox "No Internet Connection Found!", vbInformation, "TCP/IP Communication Error!"
Else
    Screen.MousePointer = vbHourglass
    Open Path For Binary As #1
                data() = Inet1.OpenURL("www.MYSITE.com/myfile.txt", icByteArray)
                Put #1, , data()
            Close #1
end if
0
 
hansamryanCommented:
Or instead of forcing your software to use uneccary resources and if you are confident that your user will have IE5+. You can use MSXML.

I don't have the code in front of me. I will find it if you are intersted
0
 
aelatikCommented:
'JUST CUT AND PASTE

Private Sub Form_Load()
GetHTMLCode ("http://www.MYSITE.com/myfile.txt")
End Sub

Public Function GetHTMLCode(URL As String)
 Dim IE
 Set IE = CreateObject("InternetExplorer.Application")
     IE.Navigate URL
     While IE.Busy
         DoEvents
     Wend
        GetHTMLCode = IE.Document.documentelement.innerHTML
 MsgBox GetHTMLCode
End Function
0

Featured Post

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now