Results 1 to 3 of 3

Thread: [RESOLVED] Workbook Open Checkbox Controls

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jul 2010
    Posts
    93

    Resolved [RESOLVED] Workbook Open Checkbox Controls

    Hello,

    The follwing code works when assigned to a command button:

    Code:
    With Sheets("Email")
     cb1.Value = False
     cb2.Value = False
    End With
    But when I put the code into the workbook Open function I always get an error. I've also tried:

    Code:
    Dim chkBox As Object
        For Each chkBox In Sheets("Email").CheckBoxes
        chkBox.Value = False
    Next chkBox
    These are activex checkboxes. Thanks.

  2. #2
    Hyperactive Member
    Join Date
    Oct 2010
    Location
    Indiana
    Posts
    457

    Re: Workbook Open Checkbox Controls

    vb Code:
    1. Dim chk As OLEObject
    2.    
    3.     For Each chk In Sheets("Sheet1").OLEObjects
    4.    
    5.         'OLEType 2 is the checkbox, this is so it will ignore any other OLEobjects
    6.         'on your worksheet
    7.         If chk.OLEType = 2 Then
    8.             chk.Object.Value = True
    9.         End If
    10.     Next

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Jul 2010
    Posts
    93

    Re: Workbook Open Checkbox Controls

    Thanks!

Posting Permissions

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



Click Here to Expand Forum to Full Width