![]() |
Saveas csv file
I need to save a xls file as csv.
When I save it manualy by using saveas, and choosing csv format in the drop down box, everything is OK. But when I try to program it in VB, all the data is put in column A. Can anybody help? |
Saveas csv file
Hi,
did you try macro recorder? Regards, Ivan |
Saveas csv file
Hi
Yes. When i juse the recorder, all the data is arrangende in column A Regards Fib "Ivan Raiminius" skrev: Hi, did you try macro recorder? Regards, Ivan |
Saveas csv file
Hi,
so, you are using: workbooks("some workbook").SaveAs Filename:= _ "some filename(including path).csv" _ , FileFormat:=xlCSV, CreateBackup:=False in your code? Regards, Ivan |
Saveas csv file
Hi
My code is: Windows("record.xls").Activate ActiveWorkbook.SaveAs "F:\record.csv", FileFormat:=xlcsv I have tryed this one as well, but havent been able to create the same format, like the format when I am saving it manualy. Windows("record.xls").Activate Const xlcsv = 1 '(I have tryed every number from 1 to 100. ) ActiveWorkbook.SaveAs "F:\record.csv", FileFormat:=xlcsv Best regards Fib "Ivan Raiminius" skrev: Hi, so, you are using: workbooks("some workbook").SaveAs Filename:= _ "some filename(including path).csv" _ , FileFormat:=xlCSV, CreateBackup:=False in your code? Regards, Ivan |
Saveas csv file
Hi,
xlcsv = 6 your code should work. What is the exact problem? What do you see when you open your .csv file in Notepad? and in Excel? Regards, Ivan |
Saveas csv file
Hi
When I use the code xlcsv = 6, it puts all the data in column A. Regards Fib "Ivan Raiminius" skrev: Hi, xlcsv = 6 your code should work. What is the exact problem? What do you see when you open your .csv file in Notepad? and in Excel? Regards, Ivan |
Saveas csv file
Hi,
I understand, I am asking what you see in Notepad if you open the .csv file in it. In Excel you see all values in column A, separated by comma? Regards, Ivan |
Saveas csv file
Hi.
That is correct. In notepad the values are all separated by semicolons when saved manualy Saved with VB the values are all separated by comma. "Ivan Raiminius" skrev: Hi, I understand, I am asking what you see in Notepad if you open the .csv file in it. In Excel you see all values in column A, separated by comma? Regards, Ivan |
Saveas csv file
Hi,
and you use as delimiter (in formulas) semicolon rather then comma? The behaviour you are describing is OK. The file should be separated by commas (csv = Comma Separated Values). The problem is caused by your column delimiter (which is set to be semicolon ";" instead of comma ","), so your columns are not recognized. You can use this to open the .csv (comma separated) file with columns recognized: Workbooks.OpenText filename:="filename", _ dataType:=xlDelimited, comma:=True or you can save it with semicolons as delimiter using: workbooks("some workbook").SaveAs Filename:= _ "some filename(including path).csv" _ , FileFormat:=xlCSV, CreateBackup:=False, local:=true I hope it helped. Regards, Ivan |
Saveas csv file
Hi Ivan
You are a genious. I have tried to solve this problem for weeks. Thank you very much. Best regards Fib "Ivan Raiminius" skrev: Hi, and you use as delimiter (in formulas) semicolon rather then comma? The behaviour you are describing is OK. The file should be separated by commas (csv = Comma Separated Values). The problem is caused by your column delimiter (which is set to be semicolon ";" instead of comma ","), so your columns are not recognized. You can use this to open the .csv (comma separated) file with columns recognized: Workbooks.OpenText filename:="filename", _ dataType:=xlDelimited, comma:=True or you can save it with semicolons as delimiter using: workbooks("some workbook").SaveAs Filename:= _ "some filename(including path).csv" _ , FileFormat:=xlCSV, CreateBackup:=False, local:=true I hope it helped. Regards, Ivan |
All times are GMT +1. The time now is 01:15 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com