3
I do most of my stats in R, thus I know nothing about Excel macros and must ask for help. My institute provides MS Office 2010 (currently), so I use that to do quick edits to my data sets, then I save them as tab limited .txt files and open them in R. I use .xlsx file format, because I can save several data sets in the same file. This makes it easier to keep track of different projects.
However, Excel is excel after all. Whenever I try to save as txt file it first asks me, if want to replace the earlier txt file I have created. Then it says that the file format can't support multiple tabs and I must click "OK". As if this wasn't enough, next it asks if I really want keep the workbook in this format...and finally, after clicking half a dozen times, I have my txt file, but now I have to close it, since I don't want to edit the txt file, since I would lose these edits in .xlsx file. Well, when I close Excel, it asks if I want to save my .txt file again!
Now after 5 years of reading these warnings almost every working day, I am sick of this. I gotta find a better system. It appeared to me that maybe a macro would help.
I would like the macro to save current tab of my .xlsx file as tab limited .txt file into the folder where the .xlsx file is located. I want it to use the name of the current tab as file name and overwrite any previous files with the same name. And I want to do this with one click.
Great question. I struggle with this too. Is there a better forum for this? Why the close vote? – None – 2011-12-15T03:37:15.963
Because xlsx package solves the problem better than any VBA macro. Just do read.xlsx("filename.xlsx", "tabname"). I was looking for this kind of package about a year ago. That time there was one, but it didn't work very well. This one seems to work better. I didn't know about it. – Mikko – 2011-12-15T15:14:36.183