Working with VBA Macros

Visual Basic for Applications (VBA) is an implementation of Microsoft's Visual Basic which is built into all Microsoft Office applications.

Support for VBA is not complete, but it covers a large portion of the common usage patterns. Most macros use a manageable subset of objects in the Excel API (such as the Range, Worksheet, Workbook, etc.) and the support include those objects, and the most commonly used method/properties of those objects.

Loading Microsoft Office documents with executable VBA macros

Choose - Load/Save - VBA Properties and mark the Executable code checkbox. Then load or open your document.

αž€αžΌαžŠβ€‹αžŠαŸ‚αž›β€‹αž’αžΆαž…β€‹αž”αŸ’αžšαžαž·αž”αžαŸ’αžαž·αž”αžΆαž“

αž€αžΌαžŠ VBA (Visual Basic for Applications) αž“αžΉαž„β€‹αžαŸ’αžšαžΌαžœβ€‹αž”αžΆαž“αž•αŸ’αž‘αž»αž€β€‹αžšαž½αž…αžšαžΆαž›αŸ‹β€‹αžŠαžΎαž˜αŸ’αž”αžΈβ€‹αž”αŸ’αžšαžαž·αž”αžαŸ’αžαž·Β αŸ” αž”αŸ’αžšαžŸαž·αž“β€‹αž”αžΎβ€‹αž”αŸ’αžšαž’αž”αŸ‹β€‹αž’αžΈαž€β€‹αž“αŸαŸ‡β€‹β€‹αž˜αž·αž“β€‹αžαŸ’αžšαžΌαžœβ€‹αž”αžΆαž“β€‹αž‚αžΌαžŸβ€‹αž’αžΈαž€αž‘αŸ αž€αžΌαžŠ VBA αž“αžΉαž„β€‹αžαŸ’αžšαžΌαžœβ€‹αž”αžΆαž“β€‹αž’αž’αž·αž”αŸ’αž”αžΆαž™β€‹ αžŠαžΌαž…αŸ’αž“αŸαŸ‡β€‹αžœαžΆβ€‹αž’αžΆαž…β€‹αžαŸ’αžšαžΌβ€‹αžœαž”αžΆαž“β€‹αžαŸ’αžšαž½αžαž–αž·αž“αž·αžαŸ’αž™ αž”αŸ‰αž»αž“αŸ’αžαŸ‚β€‹αž˜αž·αž“β€‹αžšαžαŸ‹β€‹αžαŸ‚Β αŸ”

αžšαžΌαž”β€‹αžαŸ†αžŽαžΆαž„β€‹αž–αŸαžαŸŒαž˜αžΆαž“β€‹αž‡αŸ†αž“αž½αž™

After loading the VBA code, LibreOffice inserts the statement Option VBASupport 1 in every Basic module to enable a limited support for VBA statements, functions and objects. See Option VBASupport Statement for more information.


Running VBA Macros

Run VBA macros in the same way as LibreOffice Basic macros.

αžšαžΌαž”β€‹αžαŸ†αžŽαžΆαž„β€‹αž–αŸ’αžšαž˜αžΆαž“

Since support for VBA is not complete, you may have to edit the VBA code and complete the missing support with LibreOffice Basic objects, statements and functions.


Editing VBA Macros

VBA macros can be edited in the LibreOffice Basic IDE.