Word VBA ContentControls in Header

I spent days trying to figure out a good way to set the value of a word content control in the header of a document using VBA. The solution was very useful for dealing with content controls in general…

The problem is that Word splits a document up into different regions (called stories) and each seem to contain their own collections. So the thisdocument.contentcontrols collection only refers to content controls located in the main section of your document, but not the header and footer.

If you want to put content controls in the header and footer, you can run into trouble.

There are a couple of solutions to addressing content controls in the header and footer of a word document, but I prefer the solution by Sunil Thomas at the following forum:


Syntax is:

ActiveDocument.SelectContentControlsByTag("Your-Content-Control-Tag").Item(1).Range.Text = strYourString

Since I only have three content controls to address, I don’t need to loop through the collection and I can just address them by tag. Simple, love it!

Word VBA Window

Written by Admin @ Brettg.com in: VBA | Tags: , , , ,

I’m going Froyo and Mango simultaneously

Or maybe I’m just going crazy! The Android 2.2 Froyo update announced itself on my Motorolla Defy phone yesterday.

The HTC Mozart has also been reminding me of the Mango (Copy and Paste etc) update too… Great phones both of them… Have not looked back at the iPhone which is gathering dust for one second!

The most liberating digital experience you can ever have is not having iTunes on your PC!!!!

Updating them both now, hoping that it improves general performance for the Defy. Interested to see what goodies turn up on the Mozart. The Windows Phone 7 Interface is the most flowing and useful of all of the phone interfaces in my opinion, and I prefer this phone out of all of them.

We’ll see how this goes…

Written by Admin @ Brettg.com in: Technology | Tags: , , , , , , ,

Theme: TheBuckmaker.com Themes for WordPress | Cheap Web Hosting compared, Camping