Sono riuscito a risolvere il problema creando questa macro:
Codice:
Sub copia_mia()
'
' copia_mia Macro
'
' Scelta rapida da tastiera: CTRL+k
'
ChDrive "D"
ChDir "D:\pippo\"
FileNome = Application.GetOpenFilename("Text Files (*.txt), *.txt")
Application.CutCopyMode = False
With ActiveSheet.QueryTables.Add(Connection:= _
"TEXT;" & FileNome, Destination:= _
Range("$A$3"))
.Name = "new2_1"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.TextFilePromptOnRefresh = False
.TextFilePlatform = 850
.TextFileStartRow = 1
.TextFileParseType = xlDelimited
.TextFileTextQualifier = xlTextQualifierDoubleQuote
.TextFileConsecutiveDelimiter = True
.TextFileTabDelimiter = True
.TextFileSemicolonDelimiter = False
.TextFileCommaDelimiter = False
.TextFileSpaceDelimiter = True
.TextFileColumnDataTypes = Array(1, 1, 1, 1, 1, 1, 1)
.TextFileDecimalSeparator = "."
.TextFileThousandsSeparator = ","
.TextFileTrailingMinusNumbers = True
.Refresh BackgroundQuery:=False
End With
End Sub
La macro apre la finestra "sfoglia" (a partire dalla cartella pippo sulla partizione D) per permettere la selezione del file di input e poi lo importa usando spazi e tab come delimitatori, il punto come separatore decimale e la virgola come separatore delle migliaia.
Spero che possa essere utile anche a qualcun altro.