1

How can I load a csv as a sheet of the current workbook in Excel-vba 2007 ?

Community
  • 1
  • 1
BuZz
  • 16,318
  • 31
  • 86
  • 141
  • 1
    possible duplicate of [Open csv file via VBA (performance)](http://stackoverflow.com/questions/9564908/open-csv-file-via-vba-performance) – assylias Mar 26 '12 at 13:54

2 Answers2

1

I suppose you would need to save it as a csv file. Something like this:

ActiveWorkbook.SaveAs Filename:="c:\whatever.csv", FileFormat:=xlCSV

See here for more on how to use the SaveAs method.

Is this what you're after?

EDIT

Or if what you're after is to import a csv file like Jerry answered but with VBA, then I believe you use the OpenText method.

Workbooks.OpenText FileName:="c:\whatever.csv"
mattboy
  • 2,870
  • 5
  • 26
  • 40
0

You would use the Data > Import data > (choose file) > import options > [x] New Worksheet

Jerry Beaucaire
  • 3,133
  • 16
  • 14