Hi all,
This is a little off-topic, but it is on the general topic of getting
data in R. I'm looking for a excel macro / vba script that will
export all spreadsheets in a directory (with one file per tab) into
csv. Does anyone have anything like this?
Thanks,
Hadley
--
http://had.co.nz/
Hi,
Try this macro:
Sub SaveAllCsv()
Dim xl As New Excel.Application
Dim wk As New Excel.Workbook
Dim s As Excel.Worksheet
Dim fso As New FileSystemObject ' You need set the Microsoft Scripting
Runtime in References
Dim a As File
Dim f As Folder
Dim pathDir, pathDirOut As String
' Set dir of
Hi Hadley,
in VBA you can do sth. like
Sub save_all_csv()
oldName = ThisWorkbook.FullName
curpath = ThisWorkbook.Path
For Each ws In ActiveWorkbook.Worksheets
ws.SaveAs Filename:=curpath \ ws.Name .csv,
FileFormat:=xlCSV, CreateBackup:=False
Next
'bring old file back
Workbooks.Open
3 matches
Mail list logo