Hi all,
I have a .txt file stored on a server, not it's pretty well formatted with paragraphs, spacing, tabs, and even bullet points. When accessed directly with the browser, it displays fine. However, using Inet's GET method:
Or the "DownloadFromURL" method:Code:TextIn = WebInet.OpenURL("http://URLHERE/DIR/Assign.txt") Open "C:\Assign.txt" For Output As #FF Write #FF, TextIn Close #FF DFU Shell "notepad.exe C:\Assign.txt", vbNormalFocus
Just download the text file as one huge block of text, unformatted, with wierd characters where the bullets / tabs should be. How can I download the file and retain it's original formatting? I can use this GET method to download a .doc of the same file, and it stays completely in tactCode:Private Sub DownLoadFromURL(ByVal url As String, ByVal filename As String) ' ' Download a file from a given URL ' Dim bytes() As Byte Dim fnum As Integer Dim ftext As String ' ' Download the file and load into byte array ' ftext = url & filename bytes() = WebInet.OpenURL(ftext, icByteArray) fnum = FreeFile ' ' Write the downloaded file to disk ' Open "C:\" & filename For Binary Access Write As #fnum Put #fnum, , bytes() Close #fnum End Sub DownLoadFromURL "http://URL/DIR", "Assign.txt"
Thanks![]()




Reply With Quote