Pin Me

Office 2010 VBA Support

written by: Michael Elkins•edited by: Christian Cawley•updated: 12/13/2010

Want to know the specifics of Office 2010 VBA support? Not sure what VBA programming is and want to read an overview of it? This article provides a brief description of VBA support in the MS Office 2010 productivity suite.

  • slide 1 of 5

    Office 2010 VBA Support: An Overview

    VBA, or Visual Basic for Applications, is a programming language that can be used in Microsoft Office 2010 to perform certain tasks more efficiently. In addition VBA programming allows a more customizable experience allowing for functionality that exists outside of the standard features of the Office 2010 productivity suite.

    Nearly every operation that can be completed within Office 2010 using a mouse, keyboard or dialog box can be automated through VBA programming. However, VBA isn't only for the automation of repetitive tasks. VBA can also be used to provide reminders and action prompts to the user, adding additional flexibility and interactivity. Microsoft Office 2010 supports VBA programming, just like its predecessor, MS Office 2007.

  • slide 2 of 5

    MS 2010 VBA Scripts, the Visual Basic Editor, and the Object Model

    Office 2010 MS Office 2010 VBA support is standard, and VBA programming is done through the Visual Basic Editor. The editor is installed by default, but it needs to be added to the ribbon to be accessible. Once added to the ribbon of tools, it will be available for writing scripts. The MS Office 2010 Productivity Suite is designed using the Object Model.

    The object model segregates a program into a series of heirarchical objects that control specific actions within the program. VBA scripts function by sending commands to certain objects within the Office programs that control the function they wish to enlist as part of their script or macro.

    For instance, if you wanted to create a VBA macro that opened a new document then copied and pasted all of the information from the present document into the new document and then saved it, it would need to access the objects that controlled those functions. If it did not have access to those objects, it could not perform the functions.

  • slide 3 of 5

    Microsoft Office 2010 VBA Uses

    VBA scripts are especially good at completing large, repetitive tasks within a document. If you had a Word document with a very large table, and you needed to modify the contents of each cell to reflect a different value or set of characters, you could perhaps save time by using a VBA script. Additionally, and perhaps more importantly, VBA can be used to provide a level of interactivity not present in documents created without VBA scripts.

    For instance, a document that is used to tally the monthly materials costs in a small cabinet shop could include a script that reminded the person opening a document to include any carryover expenses not accounted for in the last report. Or perhaps a certain employee always forgets to bill their accounting time under a different labor code than the code used for their standard administrative duties.

    VBA code could be used to create and display a message that said, "Please remember to bill accounting hours under code 903," every time an accounting-related file was opened.

  • slide 4 of 5

    VBA Macros Disabled by Default

    MS Office 2010 with VBA Install Due to security threats that can arise by allowing macros to run in standard documents, macros are disabled by default and must be activated. If a program is saved as a ".docm" file type, you will be able to run macros within the file.

    However, if the document is saved as a traditional ".docx" macros are disabled, and you will not be able to run your VBA scripts.

  • slide 5 of 5

    Resources

    Getting Started with VBA in Office 2010: http://msdn.microsoft.com/en-us/library/ee814735.aspx