Justinlabenne
04-12-2005, 05:51 AM
From the kb here, I learned how to open xl workbooks on a website for excel, but I am running into trouble opening and writing to a text file on a website
I just want to open it, write to it, close it, part of an error handling system.
The code below is practice stuff, but it gets debugged at the file name, not sure how to open it as a text file, I can get it to open using Workbooks.Open, but it opens as read only, and in Excel obviously. Any ideas, or is this not a possible route, tried changing the append #'s, plus .txt, .log, etc... for the extension,
The website in the code works and the text file is there, in the location if anyone wants to trial it out and see what they come up with. Thanks,
Sub PracticeWrite()
' Log info into txt file on a website
Dim UName$, xlVersion$, OSVersion$
Dim WhatTime$, sLogText$, strPath$
UName = Application.USERNAME
xlVersion = "Excel version " & Application.Version
OSVersion = "Running " & Application.OperatingSystem
WhatTime = Format(Now(), "mm/dd/yy hh:mm:ss")
sLogText = UName & " " & xlVersion & " " & OSVersion & " " & WhatTime
strPath = "http://www.jlxl.net/ErrDownload.txt"
Open strPath For Append As #1
Print #1, sLogText
Close #1
End Sub
I just want to open it, write to it, close it, part of an error handling system.
The code below is practice stuff, but it gets debugged at the file name, not sure how to open it as a text file, I can get it to open using Workbooks.Open, but it opens as read only, and in Excel obviously. Any ideas, or is this not a possible route, tried changing the append #'s, plus .txt, .log, etc... for the extension,
The website in the code works and the text file is there, in the location if anyone wants to trial it out and see what they come up with. Thanks,
Sub PracticeWrite()
' Log info into txt file on a website
Dim UName$, xlVersion$, OSVersion$
Dim WhatTime$, sLogText$, strPath$
UName = Application.USERNAME
xlVersion = "Excel version " & Application.Version
OSVersion = "Running " & Application.OperatingSystem
WhatTime = Format(Now(), "mm/dd/yy hh:mm:ss")
sLogText = UName & " " & xlVersion & " " & OSVersion & " " & WhatTime
strPath = "http://www.jlxl.net/ErrDownload.txt"
Open strPath For Append As #1
Print #1, sLogText
Close #1
End Sub