Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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? |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
did you try macro recorder? Regards, Ivan |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
so, you are using: workbooks("some workbook").SaveAs Filename:= _ "some filename(including path).csv" _ , FileFormat:=xlCSV, CreateBackup:=False in your code? Regards, Ivan |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#8
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#9
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#10
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#11
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Confused here Prevent Saving File - but allow ONLY File SAVEAS Met | Excel Discussion (Misc queries) | |||
saveas CSV file | Excel Discussion (Misc queries) | |||
File SaveAs | Excel Programming | |||
Saveas with name of another file | Excel Programming | |||
SaveAs another file name, then keep working | Excel Programming |