![]() |
Opening a xls for append
Hi all,
I am using some code to put data into a sheet that will hold all users entries, but i want to to move (tab) to the next cell as at the moment it will only put the whole lot into one cell and the next lot into the next cell down and so on. Any suggestions? Open "path" & "\data.xls" For Append As #1 Print #1, Application.UserName; " Started doing task1 at "; Time() Close #1 Duncan |
Opening a xls for append
I would suggest to create/append a csv file (will be opened in Excel anyway).
I believe that is How your file is currently treated anyway. As a CSV this might look like this Dim TxtDelim, CellDelim TxtDelim=chr(34) CellDelim="," Open "path" & "\data.csv" For Append As #1 MyString=TxtDelim & Application.UserName & TxtDelim & CellDelim & TxtDelim & "Started doing task 1 at " &TxtDelim & CellDelim & cstr(Time()) Print #1, MyString Close #1 "Duncan" wrote: Hi all, I am using some code to put data into a sheet that will hold all users entries, but i want to to move (tab) to the next cell as at the moment it will only put the whole lot into one cell and the next lot into the next cell down and so on. Any suggestions? Open "path" & "\data.xls" For Append As #1 Print #1, Application.UserName; " Started doing task1 at "; Time() Close #1 Duncan |
Opening a xls for append
Thank you Felix, that is brill, copied straight in and works perfect.
I dont know what a CSV file is and what makes it differant but at the moment that doesnt matter because I have achieved my goal for the time being! Many thanks again Duncan |
Opening a xls for append
Duncan,
A CSV file is a Comma Separated Values file. i.e. what you are appending to and normally have a file extension of .csv. If you were appending your text to a real Excel file in this manner, you would end up with a corrupt workbook, as the Excel file format is binary based (BIFF8, OLEStorage or whatever). Your method works and Excel opens it because Excel can open csv file. To avoid confusion as what the file format is, it would be better to call your file(s) "Whatever.csv". NickHK "Duncan" wrote in message oups.com... Thank you Felix, that is brill, copied straight in and works perfect. I dont know what a CSV file is and what makes it differant but at the moment that doesnt matter because I have achieved my goal for the time being! Many thanks again Duncan |
All times are GMT +1. The time now is 06:10 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com