Results 1 to 4 of 4
  1. #1
    3 Star Lounger
    Join Date
    Aug 2002
    Location
    milton keynes, Buckinghamshire
    Posts
    252
    Thanks
    0
    Thanked 0 Times in 0 Posts

    add check boxes to a form (2003)

    I need to add check boxes to a form at run time, with the check box labels being populated from string variables

    I have tried various statements found in the help files without success.

    Any ideas will be much appreciated - thanks

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

    Re: add check boxes to a form (2003)

    Here is an example:

    With Me.Controls.Add("Forms.CheckBox.1", "chkTest", True)
    .Top = 100
    .Left = 100
    .Width = 200
    .Height = 18
    .Caption = "Test"
    End With

    This assumes that the code is in the userform module. If it is in another module, replace Me with the name of the userform, e.g. UserForm1.

  3. #3
    3 Star Lounger
    Join Date
    Aug 2002
    Location
    milton keynes, Buckinghamshire
    Posts
    252
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: add check boxes to a form (2003)

    Thanks, I have now got this to work.

    As a supplementary question, having now traced the relevant item in the help menu, can you please advise if there is an easy way to add radio buttons or do I have to code 2 option buttons?

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

    Re: add check boxes to a form (2003)

    You'll have to create each option button separately. Set the GroupName property of each option button in a set that should act together to the same (but arbitrary) value. Option buttons with the same GroupName are mutually exclusive, i.e. if you click one, all others with the same GroupName are turned off.

Posting Permissions

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