Excel VB macro in excel to save as .CSV

Joined
Mar 3, 2009
Messages
1
Reaction score
0
I am using a VB macro to save a list with 3 columns from excel to .csv file using the following code:

Application.ActiveWorkbook.SaveAs "filename", FileFormat:=xlCSV, local:=True

The last column may or may not contain a number. The last list separator ; appear in a irregular way. Sometimes it is missing, the error always start on a row that is a multiple of 16 (in the list below on row 64) and the error continues for 16 rows before the ending list seperator appears again. On what multiple of 16 the error uccurs is different depending on the list.

Anyone familiar with this problem or know why it appears?
The error is the same if I save it in .txt format

Line;Item Number;Quantity;Length
1;ITEM NUMBER 1;3;
2;ITEM NUMBER 2;10;
3;ITEM NUMBER 3;2;
4;ITEM NUMBER 4;1;54
5;ITEM NUMBER 5;1;561
6;ITEM NUMBER 6;1;56
7;ITEM NUMBER 7;29;
8;ITEM NUMBER 8;11;
9;ITEM NUMBER 9;2;3
10;ITEM NUMBER 10;2;
11;ITEM NUMBER 11;1;
12;ITEM NUMBER 12;1;
13;ITEM NUMBER 13;1;
14;ITEM NUMBER 14;6;
15;ITEM NUMBER 15;200;
16;ITEM NUMBER 16;56;
17;ITEM NUMBER 17;1;
18;ITEM NUMBER 18;1;
19;ITEM NUMBER 19;1;231
20;ITEM NUMBER 20;1;
21;ITEM NUMBER 21;2;
22;ITEM NUMBER 22;2;
23;ITEM NUMBER 23;1;
24;ITEM NUMBER 24;1;
25;ITEM NUMBER 25;2;23
26;ITEM NUMBER 26;1;1
27;ITEM NUMBER 27;4;
28;ITEM NUMBER 28;1;
29;ITEM NUMBER 29;1;
30;ITEM NUMBER 30;1;
31;ITEM NUMBER 31;3;231
32;ITEM NUMBER 32;3;
33;ITEM NUMBER 33;9;
34;ITEM NUMBER 34;3;
35;ITEM NUMBER 35;4;
36;ITEM NUMBER 36;2;213
37;ITEM NUMBER 37;2;3
38;ITEM NUMBER 38;1;231
39;ITEM NUMBER 39;4;23
40;ITEM NUMBER 40;1;3
41;ITEM NUMBER 41;1;6
42;ITEM NUMBER 42;1;2
43;ITEM NUMBER 43;2;21
44;ITEM NUMBER 44;2;65
45;ITEM NUMBER 45;9;32
46;ITEM NUMBER 46;6;52
47;ITEM NUMBER 47;16;84
48;ITEM NUMBER 48;3;56
49;ITEM NUMBER 49;2;2
50;ITEM NUMBER 50;5;58
51;ITEM NUMBER 51;28;65
52;ITEM NUMBER 52;4;48
53;ITEM NUMBER 53;6;135
54;ITEM NUMBER 54;30;35
55;ITEM NUMBER 55;30;
56;ITEM NUMBER 56;73;
57;ITEM NUMBER 57;73;
58;ITEM NUMBER 58;73;
59;ITEM NUMBER 59;73;
60;ITEM NUMBER 60;73;
61;ITEM NUMBER 61;146;
62;ITEM NUMBER 62;86;
63;ITEM NUMBER 63;299;
64;ITEM NUMBER 64;20
65;ITEM NUMBER 65;583
66;ITEM NUMBER 66;284
67;ITEM NUMBER 67;284
68;ITEM NUMBER 68;50
 

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