CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2001
    Posts
    16

    VBA - Need to look at Checkboxs on a worksheet

    Greetings,
    I need to loop through an array of checkboxes placed on a worksheet, not a form. With what I'm trying, I get a error - Object does not support property or method. How do I reference the controls on that worksheet?
    Thanks


  2. #2
    Join Date
    Mar 2001
    Location
    Australia
    Posts
    146

    Re: VBA - Need to look at Checkboxs on a worksheet

    I think you may want to try something like this:



    Dim xlSheet as Excel.Worksheet
    Dim shp as Excel.Shape

    set xlSheet = Worksheets("Sheet1")

    for Each shp In xlSheet.Shapes
    ' If the type is an OLE Control
    If shp.Type = msoOLEControlObject then
    MsgBox shp.Name
    End If
    next





    You may have to change the type to whatever you are looking for. (I think that type is correct if you are using the Control Toolbox in VB), but I think that should get you going.

    Hope this helps,

    Nathan.


  3. #3
    Join Date
    Mar 2001
    Posts
    16

    Re: VBA - Need to look at Checkboxs on a worksheet

    Thanks Nathan, I'll try it. I have, however, reworked my approach to what I'm trying to solve.
    Ken


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

Featured