BuZz
BuZz

Reputation: 17485

How can I load a csv as a sheet of the current workbook?

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

Upvotes: 1

Views: 2560

Answers (2)

mattboy
mattboy

Reputation: 2910

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"

Upvotes: 1

Jerry Beaucaire
Jerry Beaucaire

Reputation: 3197

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

Upvotes: 0

Related Questions