I just started to learn VBA. As far as I understood, one uses VBA to write macros in MS-Excel. But I wonder if it the only area of application for VBA. Can it be also used like many other standard languages - like Python, for example.
If it is the case, how can I compile a VBA program? Should it be compiled? How can I run such a VBA program?
The short answer is yes. You can use VBA in Office applications such as Word, Outlook and PowerPoint as well as Excel. VBA is probably used most often in Excel. And you can control other programs from Excel.
Visual Basic for Applications runs as an internal programming language in Microsoft Office (MS Office, Office) applications such as Access, Excel, PowerPoint, Publisher, Word, and Visio.
1 Answer. Show activity on this post. Excel and VBA can control external applications if they have a COM interface - that is to say, if you can declare the application as an object, create an instance of the object, and see its methods and attributes.
You can also run your VBA program from within the VBA editor. Just click the "Play" button in the middle of the menu at the top of the editor and the program will run in Excel.
VBA is compiled to p-code. P-code is an intermediate language that requires an additional runtime in order to execute. This runtime is hosted by most Microsoft Office applications (including various non-Microsoft applications).
In short, you cannot write a VBA only app that is compiled to an .EXE.
To create a stand-alone VBA-like program, you would need to use Visual Basic 6 or earlier. The successor of Visual Basic 6, of course, is VB.NET, which is a very different animal.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With