I have the code below in a macro, to copy a separate TXT file with semicolons to an Excel file:
Sub Atualizar_Dados()
Application.ScreenUpdating = False
Application.DisplayAlerts = False
'Abre o arquivo do servidor (mudado para txt ao inves de csv)
Workbooks.Open Filename:="http://pcn-sig.peccin.local/sig/ebsout/txt/pcnopmrelrefugos_mail.txt"
Columns("A:U").Select
Selection.Copy
Windows("BASE ORACLE - Teste Hora.xlsm").Activate
Sheets("BASE").Select
Range("A1").Select
'colar especial
Selection.PasteSpecial Paste:=xlPasteValues, Operation:= _
xlNone, SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False
ActiveWorkbook.RefreshAll
'Seleciona a coluna com os dados
Columns("A").Select
'Ativa a função texto para coluna
Selection.TextToColumns _
Destination:=Range("A1"), _
DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, _
ConsecutiveDelimiter:=False, _
Tab:=True, _
Semicolon:=False, _
Comma:=False, _
Space:=False, _
Other:=True, _
OtherChar:=";"
'Ativa o arquivo aberto do servidor
Windows("pcnopmrelrefugos_mail.txt").Activate
'Fecha o arquivo
ActiveWorkbook.Close
Sheets("CAPA").Select
ActiveWorkbook.RefreshAll
ActiveWorkbook.Save
End Sub
The TXT file, for example, has a date like this:
12/11/18 21:21:42
But this same line in Excel looks like this:
11/12/2018 21:21
In addition, in Excel the dates are in different format, as below:
I deleted the column in Excel and created another, but it did not solve. Any suggestions?