0

I read this question: Can I split a spreadsheet into multiple files based on a column in Excel 2007?

I have a question regarding the "Save in same format as original workbook" that I hope you can help me with.

I'm using the macro with a CSV file but I want to have the final files like XLS.

How can the macro be changed to save in this format (different than original one)?

1
  • The macro is placed in the workbook. The native format of this is xls (or xlsm) that you use data from a csv file does not change the filetype of the workbook you are in. Nov 25, 2015 at 12:29

1 Answer 1

0

Here is a typical sample:

Sub Sample_Cvs_To_Xlsx()
    ChDir "C:\TestFolder"
    Workbooks.Open Filename:="C:\TestFolder\WhatEver.csv"
    '
    ' perform processing
    '
    ActiveWorkbook.SaveAs Filename:="C:\TestFolder\WhatEver.xlsx", FileFormat:= _
        xlOpenXMLWorkbook, CreateBackup:=False
    ActiveWorkbook.Close
End Sub

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .