vba open text file code example
Example: excel vba open text file
'VBA function to open text file and retrieve the entire content
'as a string:
Function OpenTextFile$(f)
With CreateObject("ADODB.Stream")
.Charset = "utf-8"
.Open
.LoadFromFile f
OpenTextFile = .ReadText
End With
End Function
'--------------------------------------------------------------------
s = OpenTextFile("C:\123.json")
MsgBox Len(s)