Me Keyword And Tick Boxes

  • I have created a document which makes use of hundreds of control toolbox tick boxes. Each time one of these is checked, the text values change, i.e. goes bold and black, or normal and grey when unchecked. At the moment, I have to use something like the following for every checkbox...

    Code
    If Checkbox1.Value = True Then
         Checkbox1.Bold = True
         Checkbox1.ForeColor = Black
    Else
    If Checkbox1.Value = False Then
         Checkbox1.Bold = False
         Checkbox1.ForeColor = Grey
    End If


    However, due to the number of tick boxes and the number of times this code is repeated, it now takes around 2 minutes to open the document. What I ideally want is just one macro which each tick box calls when checked/unchecked to change it's own values, i.e. something like..

    Code
    Sub TickBox()
         If Me.Value = True Then
              Me.Bold = True
              Me.ForeColor = Black
         Else
              Me.Bold = False
              Me.ForeColor = Grey
         End If
    End Sub


    However, I can't get this to work as this isn't the correct way to use the MY keyword, any help would be greatly appreciated


    Thanks

  • Re: Me Keyword And Tick Boxes


    welcome to Ozgrid


    I suggest that you read the Forum Rules that you agreed to. You neglected to use Code tags despite being reminded on the page from which you asked this question.


    I have added them this time, but future posts may well be deleted for non-compliance with the Rules

  • Re: Me Keyword And Tick Boxes


    I sort of made progress with this at the weekend, or perhaps realised what the problem really is. I removed all of the VBA code already added and the document was still as slow opening, so the problem doesn't appear to be the code. I then removed the check-boxes and the whole thing sped up, so the question really is...


    "is there a way to speed up opening word when you have hundreds of 'control toolbox' created checkboxes in your document?"


    Thanks

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!