Hi All
I am reading a text file (.txt) into VBA (ACCESS)
The text file could have an unknown number of lines.
I need to write all the lines into one variable for use as an email line.
Can any one help ?????
Dim fso As FileSystemObject
Dim strContents As String
Set fso = New FileSystemObject
strContents = fso.OpenTextFile("[COLOR=Red]... Path to file here ...[/COLOR]", ForReading).ReadAll
Code:
Dim intFileNum As Long
Dim strContents As String
intFileNum = FreeFile
Open "[COLOR=Red]... Path to file here ...[/COLOR]" For Input As intFileNum
strContents = Input(LOF(intFileNum), intFileNum)
Close intFileNum
strContents will contain the contents of your file.