SmartTagInitialize Method [Office 2003 SDK Documentation]

Initializes objects.

Applies To

ISmartTagAction2

Syntax

[Visual Basic 6.0]

Private Sub ISmartTagAction2_SmartTagInitialize(ByVal ApplicationName As String)

[Visual C++ 6.0]

STDMETHODIMP CSTAction::SmartTagInitialize(BSTR ApplicationName)

[Visual Basic .NET]

Public Sub SmartTagInitialize(ByVal ApplicationName As String) Implements Microsoft.Office.Interop.SmartTag.ISmartTagAction2.SmartTagInitialize

[Visual C#]

public void SmartTagInitialize(string ApplicationName)

Parameters

ApplicationName  A string that represents the name (ProgID) of the calling application. This is a way of getting the name of an application regardless of the application. It is also used to identify applications that do not support the passing in of a Target (because, for example, they are not automatable).

The following table lists ProgIDs for Microsoft applications.

Application ProgID
Access 2003 Application.Access.11
Excel 2003 Excel.Application.11
PowerPoint 2003 PowerPoint.Application.11
Word 2003 Word.Application.11
Internet Explorer (5.0, 5.5, 6.0) Ietag.ooc.1

Remarks

Using the SmartTagInitialize method to initialize smart tags gives you an chance, early in the process, to change the behavior of the smart tag based on host information. It is not something that could be done with the Class_Initialize method.

In addition, in certain scenarios, it is recommended that you use the SmartTagInitialize method to initialize objects rather than the Class_Initialize method. The SmartTagInitialize method is called only once when the smart tag DLL is loaded. In Visual Basic 6.0, the Class_Initialize method could get called several times during a session, and in certain scenarios, this could cause your code to fail if there is no proper error handling. If an object cannot be initialized for some reason, your code will fail. For example, you may want to initialize a socket or database connection when your smart tag runs. If you are using the Class_Initialize method and your code is not written to handle different scenarios, and initialization failed because an object has already been initialized, your code could fail.