Tuesday, September 9, 2008

Writing to a new file in VBA - Ms Access Module

Dim outFile 'Dim outFileOpen

outFile = FreeFile
'Merely VBs way of returning you the next available file handle

Open "C:\AccessDBInfo.txt" For Output As #outFile
'using the file handle and tying it with a path

Print #outFile, "Test1" + vbTab + "Test2"
'Writing to the file

Close #outFile
'Closing file handle


If you want to append to an existing file, simply use...
Open "C:\AccessDBInfo.txt" For Append Access Write Lock Write As #outFile
instead.

No comments: