Smart tags built using Visual Basic 6 don't work with Word 2010 and PowerPoint 2010.

 

Recently I worked on a problem where the Visual Basic 6 (VB6) Smart tags were not working with Word 2010 and PowerPoint 2010. The same VB6 smart tags work fine in Word 2007 and PowerPoint 2007.

The issue was, when we right click a term (which the smart tag recognizes) and select the "additional actions" option on the context menu, the office application (Word 2010 or PowerPoint 2010) crashes, as shown in the screenshot below:

Figure1

Exceptionally, VB6 Smart tags work fine with Excel 2010.

On analyzing the code for Word 2010 and PowerPoint 2010, I found that the problem is because of the change in the way smart tag related callbacks are handled in Word & PowerPoint 2010. In Office 2007 and earlier versions, smart tags related callbacks used to happen on the same thread. But in Office 2010 (Word & PowerPoint), the smart-tags recognize callbacks happen on different thread than the smart-tag initialization callbacks. Visual Basic 6 supports running VB code on threads where VB6 is initialized. It doesn't work if the Thread local storage (TLS) (https://msdn.microsoft.com/en-us/library/ms686749(VS.85).aspx) is not fully initialized.

So if we can ensure that VB is initialized on the thread (thread 0) where the recognize is called, this issue won't come up.

As a workaround, one can create a do-nothing/dummy VB6 COM add-in for Word 2010 and PowerPoint 2010 which initializes the thread 0 on which recognize is called later. It resolves the issue. Here is an article that you can refer to for this:

Building a COM Add-in using VB6: https://msdn.microsoft.com/en-us/library/aa140195(office.10).aspx