Hello Friends,
Is there any way to open the file using dialogue box for selecting the file and the run macro to convert .rpt file to excel file using "fixed width" ?
I tried recording following macro. But file path is fixed.
Please assist ...
Sub Trial_Bal()
Application.GetOpenFilename
Workbooks.OpenText Filename:= _
"G:\Daily Balance Sheet\2023-24\03 June 2023\30062023\Trial_Balance_30062023.rpt" _
, Origin:=437, StartRow:=1, DataType:=xlFixedWidth, FieldInfo:=Array( _
Array(0, 1), Array(4, 1), Array(14, 1), Array(59, 1), Array(79, 1), Array(99, 1)), _
TrailingMinusNumbers:=True
Cells.Select
Selection.Columns.AutoFit
ActiveWindow.Zoom = 85
Range("D9").Select
ActiveWindow.FreezePanes = True
Columns("D:E").Select
Selection.Replace What:=",", Replacement:="", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
Selection.Style = "Comma"
Range("A8").Select
Range(Selection, ActiveCell.SpecialCells(xlLastCell)).Select
Selection.AutoFilter
Range("D9").Select
End Sub
Bookmarks