gunny2k9
06-01-2011, 05:33 AM
ok so i have a userform with a TextBox and would like the textbox to display text from a text file (outside of excel)
basicly a 3rd party program writes an error log and then using Excel vba the apps UserForm displays said error log in a textbox on said UserForm ( to save the user from looking for the error log file
?
i know this code can open and read a text file to place said text to the debug screen
Sub ReadStrangeFile()
' Requires a reference to Microsoft Scripting Runtime (Tools > References)
Dim FSO As FileSystemObject
Dim FSOFile As File
Dim FSOStream As TextStream
Set FSO = New FileSystemObject
Set FSOFile = FSO.GetFile("C:\Sample.txt")
Set FSOStream = FSOFile.OpenAsTextStream(ForReading, TristateUseDefault)
Do While Not FSOStream.AtEndOfStream
Debug.Print FSOStream.ReadLine
Loop
End Sub
basicly a 3rd party program writes an error log and then using Excel vba the apps UserForm displays said error log in a textbox on said UserForm ( to save the user from looking for the error log file
?
i know this code can open and read a text file to place said text to the debug screen
Sub ReadStrangeFile()
' Requires a reference to Microsoft Scripting Runtime (Tools > References)
Dim FSO As FileSystemObject
Dim FSOFile As File
Dim FSOStream As TextStream
Set FSO = New FileSystemObject
Set FSOFile = FSO.GetFile("C:\Sample.txt")
Set FSOStream = FSOFile.OpenAsTextStream(ForReading, TristateUseDefault)
Do While Not FSOStream.AtEndOfStream
Debug.Print FSOStream.ReadLine
Loop
End Sub