+ Reply to Thread
Results 1 to 4 of 4

is there way to open .rpt files using vba ?

  1. #1
    Forum Contributor
    Join Date
    05-11-2013
    Location
    Mumbai
    MS-Off Ver
    Excel 2007 / 2010
    Posts
    272

    is there way to open .rpt files using vba ?

    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

  2. #2
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow Re: is there way to open .rpt files using vba ?


    Hello,

    you can try the VBA method GetOpenFilename for example …

  3. #3
    Forum Contributor
    Join Date
    05-11-2013
    Location
    Mumbai
    MS-Off Ver
    Excel 2007 / 2010
    Posts
    272
    I am sorry. I do not know the coding language.

    Could u please assist with the GetOpenFilename command?

    Quote Originally Posted by Marc L View Post

    Hello,

    you can try the VBA method GetOpenFilename for example …

  4. #4
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow Re: is there way to open .rpt files using vba ?


    Read VBA help for optimizing …

    PHP Code: 
        V Application.GetOpenFilename("rpt files,*.rpt"):  If False Then Exit Sub
        Workbooks
    .OpenText V _ 
    ► Do you like it ? ► So thanks to click on bottom left star icon « Add Reputation » !

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Open files choosing path in combobox and files in checkbox (user form)
    By Nastya621 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-10-2020, 11:32 AM
  2. [SOLVED] Open excel files, copy sheet 1 to new location and close original files
    By ghostly1 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-08-2015, 11:48 AM
  3. macro to open files and copy specific sheet into new workbook (have open files part)
    By dangerdavedsp in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-04-2015, 02:23 PM
  4. Replies: 0
    Last Post: 04-13-2013, 10:45 AM
  5. [SOLVED] Open all files in a SharePoint folder (Problem: Files open out of order)
    By holmstarrunner in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-10-2012, 10:13 AM
  6. Replies: 1
    Last Post: 01-31-2012, 09:07 PM
  7. A Macro to open 2 linked files copy 3rd files Input sheet
    By barrha0b in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-15-2010, 09:53 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1