ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Open a TXT file from WEB ? (https://www.excelbanter.com/excel-programming/307282-open-txt-file-web.html)

Damir Sudarevic

Open a TXT file from WEB ?
 
Hi,

Would anyone know how to open (read), from the VBA, a TXT file which is on
the web ?


Thank you,

Damir



Nigel

Open a TXT file from WEB ?
 
Here is one way of reading the body text of a web page, you can pass the
webtx string looking for the values and related text as required. You need
to make a reference to Microsoft Office Object Library.

Private sURL As String, webtx As string
Private ie As Object
Sub WebLink()
Set ie = CreateObject("InternetExplorer.Application")
sURL = "http://www.xyz..com"
ie.Navigate sURL
'wait for response
Do Until Not ie.Busy And ie.ReadyState = 4
DoEvents
Loop
' get html page body text
webtx = ie.Document.body.innertext
ie.Visible = True
'close ie and remove memory references
ie.Quit
Set ie = Nothing
End Sub

Cheers
Nigel

"Damir Sudarevic" wrote in message
...
Hi,

Would anyone know how to open (read), from the VBA, a TXT file which is on
the web ?


Thank you,

Damir





Tom Ogilvy

Open a TXT file from WEB ?
 

the first thing I would try is

workbooks.Open "http://www.mysite.com/myfile.txt"

or turn on the macro recorder, and paste the URL to the file in the
File=Open dialog and see if excel opens it.

--
Regards,
Tom Ogilvy

"Damir Sudarevic" wrote in message
...
Hi,

Would anyone know how to open (read), from the VBA, a TXT file which is on
the web ?


Thank you,

Damir






All times are GMT +1. The time now is 12:07 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com