Buongiorno a tutti ...
tramite la seguente macro importo un file il cui contenuto modificato dovrà essere inserito nel file mfile.tx , ilproblema è che questo file mi viene salvato con codifica utf-8 mentre a me servirebbe in ansi per poterlo poi importare in un'altro programma...avete
qualche suggerimento ?
grazie
Public Sub trasforma_txtl()
Application.ScreenUpdating = False
Sheets("Foglio3").Select
With ActiveSheet.QueryTables.Add(Connection:= _
"TEXT;C:\test.txt", Destination:=Range( _
"A1"))
.Name = "test"
.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 = xlDelimited
.TextFileTextQualifier = xlTextQualifierNone
.TextFileConsecutiveDelimiter = False
.TextFileTabDelimiter = False
.TextFileSemicolonDelimiter = False
.TextFileCommaDelimiter = False
.TextFileSpaceDelimiter = False
.TextFileColumnDataTypes = Array(2)
.TextFileTrailingMinusNumbers = True
.Refresh BackgroundQuery:=False
End With
Dim rng As Range
Dim c As Range
Dim s As String
Dim FileNum As Integer
Dim nr As Long
FileNum = FreeFile
With Worksheets("Foglio3")
If Dir("C:\mfile\mFile.txt") <> "" Then
Kill "C:\mfile\mFile.txt"
End If
nr = .Range("A65536").End(xlUp).Row
Set rng = .Range("A1:A" & nr)
For Each c In rng
s = s & c.Value & vbCrLf
Next
End With
Open "C:\mFile\mfile.txt" For Append As #FileNum
Print #FileNum, s
Close #FileNum
end sub