Results 1 to 2 of 2
  1. #1
    5 Star Lounger
    Join Date
    Oct 2001
    Location
    San Bernardino, California, USA
    Posts
    734
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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?

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •