Hello i want to create a macro that opens a txt file into a newworkbook with only one sheet tap and save it with a specific name
the open and save directory needs to be dinamic so i can input the path and filename into cells for both open and save
i manage to open the file and arrange it into columns and rows but opens into the same sheet as my imput path and i canīt save it
could someone help me
thanks in advance
hereīs the file and this is the code i have
Sub ImportTXT()
Dim wb As Excel.Workbook
Dim ws As Excel.Worksheet
Set wb = Excel.ActiveWorkbook
Set ws = Excel.ActiveSheet
''//This opens the File
Workbooks.OpenText Worksheets("Main").Range("c4"), Origin:=xlMSDOS, StartRow:=1 _
, DataType:=xlDelimited, TextQualifier:=xlDoubleQuote, Comma:=True _
, FieldInfo:=Array(Array(1, xlTextFormat), Array(2, xlTextFormat), _
Array(3, xlTextFormat))
''//The field info array needs to be extended to match your number of columns
Columns.EntireColumn.AutoFit
''//Resize the columns
Sheets(1).Move Before:=wb.Sheets(1)
''//Move the data into the Workbook
End Sub
Bookmarks