Skip navigation

How to Examine Components with Word’s Object Browser

You can use Microsoft Office tools to examine a component's functionality. In Microsoft Word 2000 or later, for example, you select Macros or Macro (depending on the Word version) from the Tools menu, then choose Visual Basic Editor or Microsoft Script Editor-either works. If neither of these are selectable options at this point, you must use the existing menu items to record a new macro, stop the recording, then go in and edit the new macro you created.

Within the Visual Basic Editor, press F2 or select Object Browser from the View menu. From the Tools menu in the Object Browser, select the Reference option to open the References dialog box. Add a reference to your chosen component. For example, Figure A shows a sample dialog box in which I've added a reference to the Windows Script Host Object Model.

After you add the reference, select your component in the drop-down list at the top of the Object Browser. For example, in the Object Browser that Figure B shows, I selected IWshRuntimeLibrary, which is the internal name for the Windows Script Host (WSH) object model. The Object Browser lists the component's objects in the Classes pane and those objects' methods, properties, and events in the Members of pane. Highlighting a method, property, or event prompts the Object Browser to display the syntax in the pane at the bottom of the Object Browser. For example, as Figure B shows, when you highlight the FileSystemObject object's CreateTextFile method, the syntax for that method appears in the bottom pane.

An alternative to the Visual Basic Editor is to use Microsoft Script Editor. After you open Microsoft Script Editor, press Ctrl+Alt+J or select Other Windows, then Object Browser under the View menu. Click the Customize toolbar option, then select your component.

If you want to open the Object Browser quickly, open an Office application, then press Alt+F11. Wait for the window to open, then press F2. For more information about how to use the Object Browser to find Office constants for your scripts, see the sidebar "Formatting the Reports" in "AD and WMI Reporting," May 2003, http://www.winnetmag.com/windowsscripting, InstantDoc ID 38402.

Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish