if you have a template file you are adding the data to you formate the cell that will hold the date and this should fix it.
the issue you are having is due to the fact the MS believe that everyone uses the non UK date format when they create their wizard functions.
you may be better reading the file into an array and then on the output to excel format the date using the format function and processing in line by line.
if you have a template file you are adding the data to you formate the cell that will hold the date and this should fix it.
the issue you are having is due to the fact the MS believe that everyone uses the non UK date format when they create their wizard functions.
you may be better reading the file into an array and then on the output to excel format the date using the format function and processing in line by line.
David
David,
I am already using a template that is formatted correctly, but still does not work.
The last statement interested me, how would I achieve the array function?
How does the Array function work in conjunction to the file formats, so that I can modify it for my other files?
It works on the headers that the text file has and which you want to have in the xls file for example, this particular text file has 17 headers...
1 Order
2 Item
3 Partner ID
4 Partner Name
5 Shp Qty
6 Container
7 Origin
8 Early Ship Date
9 Late Ship Date
10 Sailing
11 Est Disch
12 ETA Dest
13 Vehicle Name
14 Actual Disch Date
15 Commercial Invoice
16 Invoice Value
17 BOOKING REF
A good exercise for the Heart is to bend down and help another up...
Please Mark your Thread "Resolved", if the query is solved
MyGear:
★ CPU ★ Ryzen 5 5800X
★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
★ Keyboard ★ TVS Electronics Gold Keyboard
★ Mouse ★ Logitech G502 Hero
And what does the second number in each array relate to?
Before I explain this... you need to first understand on how can you format the data in the Text to Columns. There are 3 formats 1 (GeneralFormat), 2(TextFormat) and 4(DMYFormat) for the data in the columns.
So the second number in each array relates to these formats for example let's individually assing formats for the above text file... see the pic attached...
Also we need to remember that when Excel VBA sees a *.csv filename, it ignores the FieldInfo data. Now, the dates in your file are in dd-mm-yyyy format, however Excel is seeing them as mm-dd-yyyy. Consequently, where a date is a valid mm-dd-yyyy date, Excel formats it in mm/dd/yyyy date format, otherwise it formats it as dd-mm-yyyy in general format.
If you rename the .csv to .txt (or almost anything else), then it will
format the dates as expected.
Last edited by Siddharth Rout; Oct 28th, 2008 at 08:39 AM.
A good exercise for the Heart is to bend down and help another up...
Please Mark your Thread "Resolved", if the query is solved
MyGear:
★ CPU ★ Ryzen 5 5800X
★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
★ Keyboard ★ TVS Electronics Gold Keyboard
★ Mouse ★ Logitech G502 Hero