Save file as CSV - Comma Separated

  • Thread starter Thread starter dipsy
  • Start date Start date
D

dipsy

Sub createPlanID()

Sheets("2004Data").Copy
ActiveWorkbook.SaveAs Filename:= _
"C:\New\PlanId.csv" _
, FileFormat:=xlCSV, CreateBackup:=False

End Sub

The following VBA code creates the Plan ID file. However
when I go to open the file it gives me error - SYLK: File
format not valid.

I want to take a sheet from one book and save it as a
newbook as a Comma Separated file.

Thanks.
 
You might try recording the keystrokes to save the
worksheet as a .csv file and see if that works.

MG
 
.. . .
However when I go to open the file it gives me error -
SYLK: File format not valid.
.. . .

This occurs because the file starts with an "ID" string.
Let me explain better, if you have a file where the first
line is like the follow:
ID, NAME, ADDRESS
when Excel find "ID" as the first two digit of a text
file, it think that it is a SYmbolic LinK (SYLK) formatted
file...

Hope this answer.
M.Rossi
mario.red .n.o.s.p.a.m. @email.it
 

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

Back
Top