none
how to use C# tick the checkbox in word2007 RRS feed

All replies

  • What checkbox are you referring to?
    Thursday, July 5, 2018 9:30 AM
  • it is a ActiveX Control in Word2007

    Friday, July 6, 2018 1:00 AM
  • There is a way to find out how to do this kind of things: Open Word and start recording a Macro. Perform manually the operation that you want (in this case, ticking the checkbox). Stop the Macro recording and go and look at the Macro that was captured. This will contain the VB code that performs the operation. Usually, it is reasonably straightforward to translate this VB into C#.
    Friday, July 6, 2018 6:39 AM
  • Thank for answering my question ,I try this function,but the Macro can't recording my operation to tick the checkbox
    Friday, July 6, 2018 8:10 AM
  • Hi Lvlup,

    Thank you for posting here.

    Since your question is more related to word, I will move it to Word forum for suitable support.

    https://social.msdn.microsoft.com/Forums/vstudio/en-US/home?forum=worddev&filter=alltypes&sort=lastpostdesc

    The Visual C# forum discuss and ask questions about the C# programming language, IDE, libraries, samples, and tools.

    Best Regards,

    Wendy


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Friday, July 6, 2018 8:17 AM
  • Hello Lvlup,

    Once you got the checkbox, you could set its value true/false to check/uncheck the checkbox.

    Such as.

    foreach (Word.InlineShape ishape in document.InlineShapes)
                {
                    if (ishape.OLEFormat != null && ishape.OLEFormat.ClassType == "Forms.CheckBox.1")
                    {
                       var checkBox = ishape.OLEFormat.Object;
                       checkBox.Value = !checkBox.Value;
                    }
                }

    Best Regards,

    Terry


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Friday, July 6, 2018 9:18 AM