<< Back to the article "The XML Web".
Office XP Smart Tag DLLs and Google Web APIIntroduction:
This Visual Basic 6.0 sample illustrates integrating Office XP Smart Tag DLLs with the Google Web API.
Once you download, build, register and configure the smart tag ActiveX DLL project (see below), as soon as you type any acronym in an Office XP (Word/Excel) document, it is identified as a smart tag and Office XP shows an information icon besides the acronym word:
Figure 1: WSDL and XML are identified as smart tags, and Office XP shows information icon besides these words when mouse pointer is moved above them.
Now, if you click on the smart tag icon, it shows a list of operations that can be performed on the underlined word. In our case, we simply provide an option to expand the acronym.
Figure 2: The smart tag action allows to expand the acronym.
When clicked on "Expand Acronym" menu item, the smart tag action handler uses MSXML ServerXMLHTTP to send the SOAP request to Google Web API , gets the results back and shows the values of all instances of title and directoryTitle nodes in the result document.
Figure 3: The smart tag action handler uses Google Web API to search for the acronym word, and shows the values of title and directoryTitle nodes.
For simplicity, we are showing the results in a message box, you can further extend this application and use Microsoft Word / Excel automation and update the document.
This sample illustrates how Office XP smart tags, MSXML, and Google Web API can be used together to build "interesting" applications!
To build and run this sample you'll need:
- Microsoft Office XP
- MSXML 4.0
(You can use MSXML 3.0 also, a change in the code would be required then, because the sample uses version dependent ProgIDs).
- Visual Basic 6.0
- Microsoft Office XP Smart Tags SDK
- Google Web API Authorization Key
Click here to download the Smart Tag DLL project (a Visual Basic 6.0 ActiveX DLL Project).
Setting up the environment:
Here are the steps required to successfully build, install and test the above project:
More help / Troubleshooting tips on Office XP Smart Tags:
- Open AcronymExpander.vbp Visual Basic 6.0 Project file
- Open msxmlHelper.cls class module file and update the MyAuthKey constant with your Google Web API Authorization Key value.
- Click on Project | References and make sure that Microsoft Smart Tags 1.0 Type Library, MSXML 4.0, and Microsoft VBScript Regular Expressions 5.5 type libraries are selected. If you would like to use MSXML 3.0, update the reference here and modify the msxmlHelper.cls class file.
- Build and register AcronymExpander.dll.
- In order to register this DLL as a Office XP Smart Tag DLL, it is required to make the registry entries under HKEY_CURRENT_USER\Software\Microsoft\Office\Common\Smart Tag\Recognizers\ and HKEY_CURRENT_USER\Software\Microsoft\Office\Common\Smart Tag\Actions\. The ZIP file download provided here contains a .REG file that you can use directly to make these registry entries. However, be sure to verify the CLSIDs for AcronymExpander.clsAction and AcronymExpander.clsRecognizer ProgIDs in the registry with the CLSIDs in the provided .REG file, and modify the .REG file if required.
- Start Word 2002 (XP), and make sure smart tags are enabled (by looking at Tools | AutoCorrect Options | Smart Tags). You should see an entry for Acronym Expander in this dialog box. Type any acronym (any word with all letters in uppercase), type space or Enter and the word should get underlined as in screen 1 above.
- Smart Tag KB Articles
- Developing Smart Tag DLLs
- Downloading Smart Tag SDK
Be sure to study the msxmlHelper.cls class file to learn how MSXML ServerXMLHTTP can be used to post the SOAP request to Google Web API and process the results. If you have any questions or comments, send an email to .
© 2002 perfectxml.com.