Excel Macros VBA to read data from a file and store into a string Variable
VBA to read data from a file
In this vba script you can read text from Text, HTML, JS and any other file and store into a string variable.
- Dim oFSO As Object
- Dim oFS As Object, sText As String
- Set oFSO = CreateObject("Scripting.FileSystemObject")
- Set oFS = oFSO.OpenTextFile(sFile)
- Do Until oFS.AtEndOfStream
- sText = oFS.ReadAll()
- Loop
- FileToString = sText
- Set oFSO = Nothing
- Set oFS = Nothing
Comments
Post a Comment