Naming A Worksheet

C

Charles A. Lackman

Hello,

In VB.net I am creating a CSV File.

With Excel
..SheetsInNewWorkbook = 1
..Workbooks.Add(1)
..Worksheets().Select()

(Create Columns and Rows)

When I save the file.

..Application.DisplayAlerts = False
..ActiveWorkbook().SaveAs("C:\MyCSV.csv",
..ActiveWorkbook.FileFormat.xlCSVWindows)
..ActiveWorkbook.Close()

The worksheet is named MyCSV, I want the worksheet to have a different name
than the saved file.

Any assistance will be greatly appreciated.

Thanks,

Chuck
 
D

Dave Peterson

You can change the name of the worksheet. But I wouldn't bother. The next time
you open the .CSV file, excel will use what it wants for the worksheet
name--usually the name of that .csv file (without the .csv file extension).

So it's not your saving that's the problem. It's the reopening.

Since .csv files are plain old text, there's nothing you can do with the file
itself. You can always rename the worksheet after the file is reopened.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top