|
server
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
copy from file paste to an existing xls..
I need to copy data from a text file and then insert it in to an already existing .xls document. Ive got this code, but it creates a new xls file instead of adding to an existing xls file. (NB the existing .xls file already has data in it.) any pointers appreaciated. cheers Const ForReading = 1 Set oExcel = CreateObject("Excel.Application") oExcel.Visible = True oExcel.Workbooks.Add i = 1 Set objFSO = CreateObject("Scripting.FileSystemObject") Set objFile = objFSO.OpenTextFile("C:\passwords.txt", ForReading) Do Until objFile.AtEndOfStream strLine = objFile.ReadLine arrLine = Split(strLine, ",") oExcel.Cells(i, 1).Value = arrLine(0) i = i + 1 Loop oExcel.ActiveWorkbook.SaveAs ("c:\newtest.xls") objFile.Close oExcel.Quit |
|||||||||||||||||||||||