?
Solved

Read a textfile from internet

Posted on 2003-03-12
4
Medium Priority
?
155 Views
Last Modified: 2010-05-01
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
Comment
Question by:allhailcaesar
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 3

Expert Comment

by:DocM
ID: 8123887
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
 
LVL 2

Expert Comment

by:BassTeQ
ID: 8123903
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
 

Expert Comment

by:hansamryan
ID: 8123932
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
 
LVL 14

Accepted Solution

by:
aelatik earned 60 total points
ID: 8125618
'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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Suggested Courses
Course of the Month11 days, 13 hours left to enroll

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question