Date Format Issue when converting Text File to Excel File

Hi Team,

By using Generate Data Table am converting Text file to Excel file,the data which i have in date format from text file automatically changing to another date format in excel.
How can i fix this:
Text file Date Data:03-Dec-2019
After converting displaying as:12/3/2019.

I want to display the data in same format(03-Dec-2019) in excel file ,by using this variable which i need to send an email in same format.
Appreciate your help!!

After writing it to excel
Use Invoke VBA
and attach textfile in it with code :-

Sub Macro2()
'
' Macro2 Macro
'

'
    Range("I:I").Select
    Selection.NumberFormat = "[$-409]d-mmm-yy;@"
End Sub
2 Likes

Hi @ImPratham45,

Thank you for your response.
I am getting below error:

Do following steps:


image

1 Like

Hi @ImPratham45,

I have changed the settings and no error is coming now.
But Zero(0) is missing from the date which i also want to capture .
image

which zero?

Hi @ImPratham45,

Instead of 03-Dec-2019,its displaying as 3-Dec-2019.

in that
just change
d to dd

Sub Macro2()
'
' Macro2 Macro
'

'
    Range("I:I").Select
    Selection.NumberFormat = "[$-409]dd-mmm-yy;@"
End Sub
2 Likes

Is it working?

1 Like

Hi @ImPratham45,

Its working fine,sorry for late reply as i am out of office by the time.
Thanks a ton!!

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.