+ Reply to Thread
Results 1 to 4 of 4

Retrieving the state of a checkbox (form type) from VB .NET?

  1. #1
    moogleii
    Guest

    Retrieving the state of a checkbox (form type) from VB .NET?

    Hi,

    I'm hoping someone here has the saavy to solve this problem. I can't figure
    out how to get the state of a checkbox (the Form-type) from VB.NET.

    I can get the state of the Control Toolbox version just fine.

    Here's my code for the control-type checkbox

    Dim testOLE As Excel.OLEObject
    testOLE = oWorkSheet.OLEObjects("CheckBox1")

    However, this won't work with the Form-type, so I'm assuming the Form-type
    is an OLEObject, but I no idea what it could be (a shape object?).

    Anyone have any ideas what its handle might be? And yes, I have to use the
    form-type. Help would be appreciated

  2. #2
    Dave Peterson
    Guest

    Re: Retrieving the state of a checkbox (form type) from VB .NET?

    I don't use vb.net, but if I were doing it in excel, I'd do:

    dim testCBX as excel.checkbox
    set testcbx = oworksheet.checkboxes("check box 1")

    (checkboxes from the Forms toolbar usually have slightly different spellings
    (extra spaces). So be a little careful.)



    moogleii wrote:
    >
    > Hi,
    >
    > I'm hoping someone here has the saavy to solve this problem. I can't figure
    > out how to get the state of a checkbox (the Form-type) from VB.NET.
    >
    > I can get the state of the Control Toolbox version just fine.
    >
    > Here's my code for the control-type checkbox
    >
    > Dim testOLE As Excel.OLEObject
    > testOLE = oWorkSheet.OLEObjects("CheckBox1")
    >
    > However, this won't work with the Form-type, so I'm assuming the Form-type
    > is an OLEObject, but I no idea what it could be (a shape object?).
    >
    > Anyone have any ideas what its handle might be? And yes, I have to use the
    > form-type. Help would be appreciated


    --

    Dave Peterson

  3. #3
    moogleii
    Guest

    Re: Retrieving the state of a checkbox (form type) from VB .NET?

    Hmm thanks for the help, but the code didn't work for me.

    checkbox didn't seem to be a member of excel.

    After tons of searching, i've found out that apparently the Form-type
    checkboxes are based on XLM, while the Control-type checkboxes are ADO. XLM
    was phased out, but I think there may still be a way to access them with the
    Excel 5.0 library.

    Anyone have any ideas?

    "Dave Peterson" wrote:

    > I don't use vb.net, but if I were doing it in excel, I'd do:
    >
    > dim testCBX as excel.checkbox
    > set testcbx = oworksheet.checkboxes("check box 1")
    >
    > (checkboxes from the Forms toolbar usually have slightly different spellings
    > (extra spaces). So be a little careful.)
    >
    >
    >
    > moogleii wrote:
    > >
    > > Hi,
    > >
    > > I'm hoping someone here has the saavy to solve this problem. I can't figure
    > > out how to get the state of a checkbox (the Form-type) from VB.NET.
    > >
    > > I can get the state of the Control Toolbox version just fine.
    > >
    > > Here's my code for the control-type checkbox
    > >
    > > Dim testOLE As Excel.OLEObject
    > > testOLE = oWorkSheet.OLEObjects("CheckBox1")
    > >
    > > However, this won't work with the Form-type, so I'm assuming the Form-type
    > > is an OLEObject, but I no idea what it could be (a shape object?).
    > >
    > > Anyone have any ideas what its handle might be? And yes, I have to use the
    > > form-type. Help would be appreciated

    >
    > --
    >
    > Dave Peterson
    >


  4. #4
    Dave Peterson
    Guest

    Re: Retrieving the state of a checkbox (form type) from VB .NET?

    It did work ok for me in excel's VBA.

    How about going through the shapes collection.

    This also worked for me in excel's VBA:

    Dim myShape As Excel.Shape
    Set myShape = ActiveSheet.Shapes("check box 1")
    MsgBox myShape.OLEFormat.Object.Value
    'or
    MsgBox myShape.ControlFormat.Value

    No guess if it'll work in .Net.

    moogleii wrote:
    >
    > Hmm thanks for the help, but the code didn't work for me.
    >
    > checkbox didn't seem to be a member of excel.
    >
    > After tons of searching, i've found out that apparently the Form-type
    > checkboxes are based on XLM, while the Control-type checkboxes are ADO. XLM
    > was phased out, but I think there may still be a way to access them with the
    > Excel 5.0 library.
    >
    > Anyone have any ideas?
    >
    > "Dave Peterson" wrote:
    >
    > > I don't use vb.net, but if I were doing it in excel, I'd do:
    > >
    > > dim testCBX as excel.checkbox
    > > set testcbx = oworksheet.checkboxes("check box 1")
    > >
    > > (checkboxes from the Forms toolbar usually have slightly different spellings
    > > (extra spaces). So be a little careful.)
    > >
    > >
    > >
    > > moogleii wrote:
    > > >
    > > > Hi,
    > > >
    > > > I'm hoping someone here has the saavy to solve this problem. I can't figure
    > > > out how to get the state of a checkbox (the Form-type) from VB.NET.
    > > >
    > > > I can get the state of the Control Toolbox version just fine.
    > > >
    > > > Here's my code for the control-type checkbox
    > > >
    > > > Dim testOLE As Excel.OLEObject
    > > > testOLE = oWorkSheet.OLEObjects("CheckBox1")
    > > >
    > > > However, this won't work with the Form-type, so I'm assuming the Form-type
    > > > is an OLEObject, but I no idea what it could be (a shape object?).
    > > >
    > > > Anyone have any ideas what its handle might be? And yes, I have to use the
    > > > form-type. Help would be appreciated

    > >
    > > --
    > >
    > > Dave Peterson
    > >


    --

    Dave Peterson

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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