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.

image

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)
Else
f.Code.Text = “MACROBUTTON CheckMe ” + Chr(111)
End If

Next

End Sub

image

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

image

Step 2 – Data Entry

Select MacroButton from Field names.

Enter Display Text of BOX

Select CheckMe from MacroName list

Hit OK

image

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

image

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

image

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

How to Host/embed Microsoft Word or Excel in a web browser or your own application?

I am currently looking to see if there is any demand for the feature to host Office applications, like Word or Excel in a browser or an application. I am considering writing an ActiveX control that would allow for this ability, but have not decided if it is worth the effort.

If you think you would find this useful, and would want to buy something like this, let me know. I would hate to waste my time to make something no one would use, except for me.

-Brian

regsvr32.exe registering your ActiveX (ocx) gives you error 0x80040200..yuck.

I design and work with a lot of c++ code and write a number of ActiveX controls. I set my machine up so I can double click the OCX and it is associated with regsvr32.exe, so it gets registered. Nice and easy, right? I have been doing it for years. Double click, whammo. It’s registered.

Now let’s come to the present. Happy go lucky , easy as pie, double click my way to registered controls, is gone. BAH! I upgraded to Windows 7, I knew this OS had to have a gotcha!

So I get regsvr32.exe blowing up and giving me error 0x80040200. That’s real helpful, doesn’t Microsoft speak any ENGLISH. So I go and look up that ridiculous error code, and lo and behold…wait for it….wait…….User Access Control. UAC said, go away child, you can’t play here.

The long and short of it, I typed cmd.exe into the run box on the start menu, right clicked cmd.exe when it appeared and did a runas for Administrator. I then did the old school command line register of the ocx. Sad.

When I get froggy enough, I will write a batch file that will have the always run as admin attributes on it so at least UAC can prompt me to elevate.

So in short, regsvr32 on Windows 7 with UAC. You must find a way to make regsvr32.exe run elevated as an Administrator for it to work.