Una famiglia di software per fogli di calcolo Microsoft con strumenti per l'analisi, la creazione di grafici e la comunicazione dei dati.
copio e incollo quello che mi è venuto fuori, scusate la non conoscenza.
allora sono arrivato a creare una macro così.
<cut>
ma mi da errore .
Se(se) quella che ho messo come sPath è la path dove recuperi il tuo file .txt:
Public Sub m()
Dim vNome As Variant
Dim sPath As String
sPath = "\\cecchi.loc\dati\UserDoc\fabrizio\documenti\CENTRI DI COSTO\DICEMBRE 2011"
vNome = Application.InputBox("Inserire il nome del file.", "Attenzione!")
If vNome <> False And vNome <> "" Then
With ActiveSheet.QueryTables.Add(Connection:= _
"TEXT;" & sPath & vNome & ".txt", Destination:=Range("A1"))
.Name = vNome
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.TextFilePromptOnRefresh = False
.TextFilePlatform = 1252
.TextFileStartRow = 1
.TextFileParseType = xlFixedWidth
.TextFileTextQualifier = xlTextQualifierDoubleQuote
.TextFileConsecutiveDelimiter = False
.TextFileTabDelimiter = True
.TextFileSemicolonDelimiter = False
.TextFileCommaDelimiter = False
.TextFileSpaceDelimiter = False
.TextFileColumnDataTypes = Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1)
.TextFileFixedColumnWidths = Array(9, 3, 4, 8, 4, 32, 41, 2, 7, 9, 12, 2, 7, 9, 21, 1, 27)
.TextFileTrailingMinusNumbers = True
.Refresh BackgroundQuery:=False
End With
End If
End Sub