0
I have the code below in a macro, to copy a TXT file separated by semicolon 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 the date like this:
;12/11/18 21:21:42
But that same line, in Excel, is like this:
11/12/2018 21:21
Even, in Excel the dates are with different formatting, as below:
I already deleted the column in Excel and created another, but did not solve. Some suggestion?
the date of the machine is standard EN. And the number format did not work...
– Diego
The formula Text(A1, "dd/mm/yyyy") works in the spreadsheet to format?
– Vinicio Schmidt
No, because the change happens in the function Texttocolumns, if use this formula does not change anything pq already in the format...
– Diego