+ Reply to Thread
Results 1 to 11 of 11

Disabling notes/comments using VBA

  1. #1
    Registered User
    Join Date
    02-06-2015
    Location
    Bollington
    MS-Off Ver
    2010
    Posts
    10

    Disabling notes/comments using VBA

    Hi There,

    I have an Excel with multiple notes/comments that I don't want all users to be able to edit or see. Whilst I can turn comments and indicators off using VBA code, they can easily be "turned back on" using Show Comments or Show Notes in the Ribbon.

    Is there a way to password-protect the comments at all, or disable the Comments/Notes options in the Ribbon for users?

    I've seen mention of a custom UI editor, but not sure I follow that approach.

    Looking for some advice.

    Thanks,

    Rob.

  2. #2
    Forum Expert nankw83's Avatar
    Join Date
    08-31-2015
    Location
    Kuwait
    MS-Off Ver
    365
    Posts
    1,712

    Re: Disabling notes/comments using VBA

    Hello … I am not really sure if that's doable but you can save all comments in a very hidden sheet then restore them when needed using the 2 below macros

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    02-06-2015
    Location
    Bollington
    MS-Off Ver
    2010
    Posts
    10

    Re: Disabling notes/comments using VBA

    Hi nankw83 - Thanks for responding.

    I tried using your code for hiding comments on my Sheet2 on workbook open; however, it errors out at the ReDim (Subscript out of range).

    Any suggestions here?

    Thanks,

    Rob.

  4. #4
    Forum Expert nankw83's Avatar
    Join Date
    08-31-2015
    Location
    Kuwait
    MS-Off Ver
    365
    Posts
    1,712

    Re: Disabling notes/comments using VBA

    It could be that there are no comments in "ActiveSheet" when you open the file … Try the below code & see if it errors out

    Please Login or Register  to view this content.

  5. #5
    Forum Expert nankw83's Avatar
    Join Date
    08-31-2015
    Location
    Kuwait
    MS-Off Ver
    365
    Posts
    1,712

    Re: Disabling notes/comments using VBA

    And you can do the same for the UnHide macro

    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    02-06-2015
    Location
    Bollington
    MS-Off Ver
    2010
    Posts
    10

    Re: Disabling notes/comments using VBA

    Using the revised VBA code, I'm no longer getting the error message, but it's also not hiding the comments on Sheet2. There are definitely 5 comments on Sheet2.

    Any further suggestions here?

    Thanks,

    Rob.

  7. #7
    Forum Expert nankw83's Avatar
    Join Date
    08-31-2015
    Location
    Kuwait
    MS-Off Ver
    365
    Posts
    1,712

    Re: Disabling notes/comments using VBA

    Sheet2 is the sheet name or sheet code name ? Did you change it in the code ?

  8. #8
    Registered User
    Join Date
    02-06-2015
    Location
    Bollington
    MS-Off Ver
    2010
    Posts
    10

    Re: Disabling notes/comments using VBA

    I did change the code to reflect Sheet2. Sheet2 is the code name, the sheet name is "Allocation". I ran the code step-by-step and it simply exits the sub suggestion there are no comments on Sheet2 when there definitely is...

    Thanks,

    Rob.

  9. #9
    Forum Expert nankw83's Avatar
    Join Date
    08-31-2015
    Location
    Kuwait
    MS-Off Ver
    365
    Posts
    1,712

    Re: Disabling notes/comments using VBA

    Do you have comments or notes ? The code works for notes not comments

  10. #10
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,887

    Re: Disabling notes/comments using VBA

    Rob, I'd recommend uploading sample workbook to clearly demonstrate your need. It'll be so much easier for us to help you when we have appropriate sample to work with.
    ?Progress isn't made by early risers. It's made by lazy men trying to find easier ways to do something.?
    ― Robert A. Heinlein

  11. #11
    Forum Expert nankw83's Avatar
    Join Date
    08-31-2015
    Location
    Kuwait
    MS-Off Ver
    365
    Posts
    1,712

    Re: Disabling notes/comments using VBA

    Hey Rob .. So I had some free time at home due to coronavirus curfew so it was a good opportunity to learn about Excel's new "comment" in VBA. I have revised the code significantly to accommodate for all comment & notes in all sheets of the workbook instead of only one sheet. I have also attached the sample file I was working on for your reference

    VBA code for hiding all comments/notes
    Please Login or Register  to view this content.
    VBA code to show back all comments/notes
    Please Login or Register  to view this content.
    Attached Files Attached Files

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Pulling Comments instead of Notes
    By ChemistB in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-05-2020, 10:24 AM
  2. [SOLVED] Notes and Comments
    By Chupasur in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 07-13-2019, 04:10 AM
  3. Macro transform all notes into comments
    By ViroMajor in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-12-2019, 11:43 AM
  4. Embed image into Lotus Notes with VBA - not using Notes.NotesUIWorkspace
    By pmor1503 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-11-2014, 11:49 PM
  5. end notes, foot notes and an Index Table
    By thadacto in forum Word Formatting & General
    Replies: 1
    Last Post: 12-27-2011, 06:22 PM
  6. [SOLVED] let's allow printing comments as foot- or end-notes
    By MattThom in forum Excel General
    Replies: 1
    Last Post: 01-22-2006, 07:40 PM
  7. Notes (not Comments)
    By daniels012 in forum Excel General
    Replies: 3
    Last Post: 01-18-2005, 01:39 PM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1