Results 1 to 8 of 8
  1. #1
    4 Star Lounger
    Join Date
    Nov 2002
    Location
    London, Gtr London, England
    Posts
    496
    Thanks
    8
    Thanked 0 Times in 0 Posts

    Toggling Comments - can I? (VBA/Word 2003)

    Dear Loungers,

    because my VBA journy is very young I find I often want to comment chunks of code and then uncomment then. Is there a quick way to highlight the required text and "comment" it or "uncomment" it?

    liz

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Toggling Comments - can I? (VBA/Word 2003)

    Yes:
    In the Visual Basic Editor, right-click anywhere in a toolbar.
    Select Customize... from the popup menu.
    If necessary, activate the Commands tab.
    Select the Edit category in the list of Categories on the left.
    Scroll down the list of Commands on the right until you see 'Comment Block'.
    Drag this item to a convenient location on one of the toolbars.
    Do the same for the 'Uncomment Block' item below it.
    You can now select a block of code and comment or uncomment it with one mouse click.

  3. #3
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    6,280
    Thanks
    3
    Thanked 191 Times in 177 Posts

    Re: Toggling Comments - can I? (VBA/Word 2003)

    Or View->Toolbars->Edit which has some other useful buttons.
    FWIW
    Regards,
    Rory

    Microsoft MVP - Excel

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Toggling Comments - can I? (VBA/Word 2003)

    I cannot remember whether the Comment Block and Uncomment Block are on the Edit toolbar by default or whether I used Customize to place them there - I thought the latter, but I might well be mistaken.

  5. #5
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    6,280
    Thanks
    3
    Thanked 191 Times in 177 Posts

    Re: Toggling Comments - can I? (VBA/Word 2003)

    They are there by default in XP, so I assumed the same would be true in 2003...
    I ended up resetting my toolbars in Excel the other day while answering someone's question, just to remind myself how much (or rather, how little) is there by default. If I ever lose my xlb file it will take me ages to recreate it!! <img src=/S/yikes.gif border=0 alt=yikes width=15 height=15>
    Regards,
    Rory

    Microsoft MVP - Excel

  6. #6
    4 Star Lounger
    Join Date
    Nov 2002
    Location
    London, Gtr London, England
    Posts
    496
    Thanks
    8
    Thanked 0 Times in 0 Posts

    Re: Toggling Comments - can I? (VBA/Word 2003)

    Dear Hans,

    Simple and obvious but I didn't look!

    Thank you................. liz

  7. #7
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Toggling Comments - can I? (VBA/Word 2003)

    The toolbar customizations for the Visual Basic Editor aren't stored in the .xlb file - the latter is for Excel itself only.
    The VBE toolbar customizations are shared by all Office applications. I do not know where these are stored, probably in the registry.

  8. #8
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    6,280
    Thanks
    3
    Thanked 191 Times in 177 Posts

    Re: Toggling Comments - can I? (VBA/Word 2003)

    It was the main Excel toolbars that I reset - sorry, I didn't make that at all clear! I am 99% sure the VBE commandbar settings are stored in the registry - probably in one of the Toolbar keys which, as best I recall, are binary.
    Regards,
    Rory

    Microsoft MVP - Excel

Posting Permissions

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