Handy-Dandy Scripts: closing Word gracefully

Sometimes you may find winword.exe process lingering in the memeory and there is no visible Word window that allows you to close it. Believe me, this mostly likely is not Word’s fault: chances are that those ghost Word instances are started by some third party applications via automation. But for some reason those applications are not able to terminte…


Taking snapshots for part of a Word document – the new EnhMetaFileBits property

In Word 2003 object model a new property named EnhMetaFileBits for Range and Selection object is introduced. From the documentation, you’d see that it is supposed to help getting the picture representation for a portion of a Word document. Very interesting, isn’t it? However the sample included with Word VBA help is too simple to…


Automate Office Task Pane with Active Accessibility

The background Almost every Office application provides a powerful object model(OM) to allow developers to programmatically access its functionalities. However, there are always things that are inaccessible from OM. And a lot of task panes fall into this category. For example, in Office XP and above, there is no direct way to clear the contents…


Programming Office Commandbars – get the ID of a CommandBarControl

The FindControl(FindControls) method of CommandBars collection/CommandBar object is the most useful and reliable way to get the reference to a CommandBarControl object. For built-in menu items and toolbar buttons, the control ID is required for a successful call to FindControl(s). The following VBA code snippet will list control IDs of all available CommandBarControl objects(i.e., menu…


Programming Office Commandbars – how to disable shortcut menus

This is one of the FAQs about Office Commandbars. For some reason, you may want to suppress the shortcut menus brought up by right-clicking the content of an Office document. This is an example of how to disable them in Word: CustomizationContext = ActiveDocument Dim bar As CommandBar For Each bar In CommandBars If bar.Type…


ALT-Click – A quick and easy way to use Word 2003 as a (bilingual) dictionary

If you don’t know what I am talking about, try it now in Word 2003. Hold down ALT key on your keyboard then click a word inside a document and watch the Research task pane. With the default search scope of “all reference books”, entries for this word found in Encarta, Thesaurus and Translation will be returned in seconds….