Replace C:\FolderName with the name of the folder where the text file is saved. ![]() Replace filename.txt with the name of the text file you want to get data from. ' GetTextFileData "SELECT * FROM filename.txt WHERE fieldname = 'criteria'", _ GetTextFileData "SELECT * FROM filename.txt", "C:\FolderName", Range("A3") The procedure can be used like this: Sub TestGetTextFileData() 'RS2WS rs, rngTargetCell ' works in Excel 97 or earlier RngTargetCell.Offset(1, 0).CopyFromRecordset rs ' works in Excel 2000 or later RngTargetCell.Offset(0, f).Formula = rs.Fields(f).Name Rs.Open strSQL, cn, adOpenForwardOnly, adLockReadOnly, adCmdText ![]() If rngTargetCell Is Nothing Then Exit SubĬn.Open "Driver= "
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |