How to access legacy forms checkboxes and ActiveX checkboxes in Word using C#!

Apparently, doing this simple task is not well documented. None of my searches lead to anything useful, so here is what I wrote for how to handle the search for all checkboxes in a word document then set them all to false. Obviously, you can use this to get values, launch rockets, whatever it is you want to do.

//go through legacy fields.
foreach (FormField c in vstoDoc.FormFields)
if (c.Type == WdFieldType.wdFieldFormCheckBox)
if (c.CheckBox.Value)
c.CheckBox.Value = false;
catch { }

//go through the activex fields.
foreach(Field f in vstoDoc.Fields)
if (f.Type == WdFieldType.wdFieldOCX)
if (f.OLEFormat != null)
f.OLEFormat.Object.Value = false;
catch { }


I am sure you figured out my variable vstoDoc is the document. If not, well, McDonalds always need a new fry cook.

Happy Coding!

Right click doesn’t work in Excel 2007 anymore.

My right click context menu stopped working in Excel 2007 all of a sudden. It was driving me nuts. The Excel context menu wouldn’t display.

I came across the solution, which seems to be an absurd on, but it worked.

Open excel
hit alt-f11 to get to the VBE
hit ctrl-g to see the immediate window
Type this and hit enter:
then the same with this line:
     application.CommandBars("cell").Enabled = True
Hit alt-f11 to get back to excel and test it out.


I am quite impressed someone found this solution, but also trying to figure out how in the world this happened in the first place.

Source to pay tribute to.

How to create CheckBoxes in Word 2007 without using the ActiveX or Legacy Forms checkbox!

So you think you are stuck with using that lovely ActiveX checkbox for your document. The way most people thought, I would have figured you were stuck with it too. The other alternative, the Legacy Forms checkbox, is rarely viable as you have to protect the document. That means no edits, which is a whole new pain.

Well, what’s wrong with the ActiveX checkbox you ask? Not much, if you don’t mind extreme document load times when you have a large number of them. Also if you don’t mind lugging around the ActiveX baggage and security issues that come with them. Plus the conversion issues when displaying them online.

So, what is the solution? It is much simpler than you would think. I have seen some complex solutions that people have employed with Templates and other nonsense. Those require you to give that template to the end reader and is just kludgy.

I have a simpler approach. A very short macro and the use of Fields, which in turn I use at MacroButtons. Simple, yes. Effect, yes.

Think outside the box Smile

Here is the how to:

Create a Macro named CheckMe in your document.


Paste this code into it:

Sub CheckMe()

‘ CheckMe Macro

”MsgBox “clicked”
Dim f As Field
”254 is check box
”168 is unchecked
For Each f In Selection.Fields
f.Code.Font.Name = “WingDings”
If (f.Code.Text = “MACROBUTTON CheckMe ” + Chr(111)) Then
f.Code.Text = “MACROBUTTON CheckMe ” + Chr(254)
f.Code.Text = “MACROBUTTON CheckMe ” + Chr(111)
End If


End Sub


Now you have it setup to handle the new field.

Time to add the field. After you add one, it is super simple to add more. All you will to do is copy and paste.

Add our Macro Field aka our CheckBox.

I made this really easy for you so you don’t need to lookup symbols or any of that jazz.

Step 1  – Click Insert –> Quick Parts –> Field


Step 2 – Data Entry

Select MacroButton from Field names.

Enter Display Text of BOX

Select CheckMe from MacroName list

Hit OK


But now I have the word box? That’s not a check box! You fooled me!


Well, I said I was making it easier on you. Click the word! Voila. Like magic, it is now  a check box.

image click again


Yeah! Checkbox.

You can copy and paste this to where you want, or go through the steps again. Copy and paste is easier.

I have attached a working Word 2007 document to example the alternative checkbox technique.

Happy coding!

Example of not using checkboxes