• How to know the command for a macro or VBA?

    Home » Forums » AskWoody support » Productivity software by function » MS Word and word processing help » How to know the command for a macro or VBA?

    Author
    Topic
    #463504

    If I wanted to write a small sub to be used as a macro and I knew exactly which of the ribbon commands (or menu items) I wanted to use, how would i find the exact VBA command to use in my code? Most of the time I am fortunate enough to find existing code I can modify but sometimes I cannot and need to do it from scratch. But where do you look for this information?

    Viewing 0 reply threads
    Author
    Replies
    • #1183442

      I’d record a macro of the actions that you want to include. You will probably have to edit and clean up the result, but in most situations it will give you a good idea of the code that you need. The macro recorder has its limitations though – not everything can be recorded.

      To record a macro:
      – Activate the Developer tab of the ribbon.
      – Click Record Macro in the Code section.
      – Provide a name for the macro.
      – Select “This document” from the “Store macro in” dropdown.
      – Click OK.

    Viewing 0 reply threads
    Reply To: How to know the command for a macro or VBA?

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: