MS Excel Vba/Macro equivalent in LibreCalc or OpenOfficeCalc

6,323

OpenOffice/LibreOffice has a VBA-like macro system which is designed to have a good degree of compatibility with VBA.

You can get to it by Tools->Macros->Organize Macros->(Libre/Open)Office Basic... If you then click "Edit" you get an editor that is very similar to the VBA IDE.

It's fairly likely that your macro will work with minimal modifications. (Your code seems to run without errors for me, but I obviously don't have your input files.)

Share:
6,323

Related videos on Youtube

ReggieCL
Author by

ReggieCL

Updated on September 18, 2022

Comments

  • ReggieCL
    ReggieCL over 1 year

    is there an equivalent macro/vba in libre calc that does this routine; - Read/open xls files in a path and do a batch import/copy of read sheets and merge it with the current open workbook. Here's the vba I used in MS Excel. Thanks in advance

    Sub Consolidate_Sheets()
    'Folder Path to read the xlsx files from
    
      Path = "F:\WIP2\Below 25\"
      filename = Dir(Path & "*.xlsx")
    
      Do While filename <> ""
        Workbooks.Open filename:=Path & filename, ReadOnly:=True
    
        For Each sheet In ActiveWorkbook.Sheets     
         'import/copy sheets from to read xlsx files
          sheet.Copy After:=ThisWorkbook.Sheets(1)    
        Next sheet
    
        Workbooks(filename).Close
        filename = Dir()
      Loop
    
    End Sub