Class Research (Word VBA)

Provides access to the research service feature of Microsoft Word.

Set

To use a Research class variable it first needs to be instantiated, for example

Dim rsr as Research
Set rsr = ActiveDocument.Research

Research class variables can be set using the Document.Research procedure.

FavoriteService

Returns or sets a String that specifies the favorite research service.

The String that is set or returned for this property specifies the GUID of the favorite research service. Setting this property has the same effect as choosing a favorite research service through the Research Options dialog in Word.

Dim objResearch As Research 
 
Sub MyFunction() 
 
Set objResearch = Research 
 
'Set the favorite service 
objResearch.FavoriteService = "FEF89077-4F4D-4803-A8BF-228083F70EAA" 
 
End Sub

IsResearchService

Indicates whether the GUID specified in the ServiceID parameter corresponds to a currently configured service.

Syntax : expression.IsResearchService (ServiceID)

ServiceID: Specifies a GUID that identifies the research service.

Dim strServiceID As String: strServiceID =  
Dim booIsResearchService As Boolean
booIsResearchService = ActiveDocument.Research.IsResearchService(ServiceID:=strServiceID)

Parent

Returns an object that represents the parent object of the specified Research object.

Dim objParent As Object
Set objParent = ActiveDocument.Research.Parent

Query

Specifies a research query.

Syntax : expression.Query (ServiceID, QueryString, QueryLanguage, UseSelection, LaunchQuery)

Dim strServiceID As String: strServiceID =  
Dim varQuery As Variant
varQuery = ActiveDocument.Research.Query(ServiceID:=strServiceID)

Arguments

The following argument is required

ServiceID (String) - Specifies a GUID that identifies the research service.

The following arguments are optional

QueryString (String) - Specifies the query string.

QueryLanguage (WdLanguageID) - Specifies the query language of the query string.

Here you can find possible values for WdLanguageID.

UseSelection (Boolean) - True to use the current selection as the query string. This overrides the QueryString parameter if set. Default value is False.

LaunchQuery (Boolean) - True launches the query. False displays the Research task pane scoped to search the specified research service.

SetLanguagePair

Sets the languages for the translation service.

Syntax : expression.SetLanguagePair (LanguageFrom, LanguageTo)

ActiveDocument.Research.SetLanguagePair LanguageFrom:=wdAfrikaans, LanguageTo:=wdAfrikaans

Arguments

The following arguments are required:

LanguageFrom (WdLanguageID) - Specifies the language to translate from.

Here you can find possible values for WdLanguageID.

LanguageTo (WdLanguageID) - Specifies the language to translate to.

Here you can find possible values for WdLanguageID.