Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Web CMS (TeamSite)
Display Search Dialog from another database
SirHC
Hi,
Is it possible to display a search dialog from another database in Word VBA?
We have 3 different databases, and one has a different search (and profile) dialog to the others which users only access occasionally. We would like to provide the users with a button on a form/toolbar within Word that brings up the search form from this other database (the search will only be across this database)
Regards
Chris
Find more posts tagged with
Comments
jny
Here's a VBA code example to invoke an instance of the SearchCmd which will bring up the search dialog. You may bind this to a macro button to perform your own search.
[VBA] WorkSite 8.2 DLL's are referenced in this code example.
'Type Libs Referenced:
' WorkSite 2000 Office Integration
' IManExt 1.0 Type Lib
' IManage 8.2 Type Lib
Sub search()
Dim dms As ManDMS
Dim sess As IManSession
Dim oExtend As iManO2K.iManageExtensibility
Dim cmd As SearchCmd
Dim context As ContextItems
Set oExtend = Application.COMAddIns("iManO2K.AddinForWord2000").Object
'check the current connection mode
If oExtend.CurrentMode = nrConnectedMode Then
'get the dms and session objects
Set dms = oExtend.context("NRTDMS")
Set sess = dms.Sessions.ItemByName("DSS_WIN2003SERV") 'Arbitrary example of a valid server name.
Set cmd = New SearchCmd
Set context = New ContextItems
Dim ndms As NRTDMS ' IManDMS not yet supported
Set ndms = dms
With context
.Add "SelectedIManSession", sess
.Add "NRTDMS", dms
.Add "SearchDatabaseName", "WSDSS2" 'Arbitrary example of a valid database name
' Specify the database in which to search
End With
With cmd
.Initialize context
.Update
If .Status = (.Status And nrActiveCommand) Then
.Execute
End If
End With
End If
End Sub
SirHC
Thanks jny.
Is it then possible to display the results in a file open dlg to allow the users to select which file they were after? I would prefer if the newer (Enhanced Application Integration) File Open dialog could be used.
Regards
Chris
jny
The SDK does not support returning search results using the EAI open dialog. The implementation of the displaying of search results after a search from within the dialog is internal to the source code; it's not exposed by a COM Interface.
What you could do is pass the searchparameters to the IIntegrationDlg.DocOpenDlg to show the results. Like so:
Dim myDlg As IIntegrationDlg.DocOpenDlg
Dim commands(1 To 4) As String
Dim lCommandSelected As Long
Dim hHandle As Long
'pHandle is the parent window handle
Set myDlg = New IIntegrationDlg.DocOpenDlg
'Set hHandle equal to the parent window handle
hHandle = myDlg.Window
'Define the commands that should appear on the
'action Menu
commands(1) = "
@1@&
;Open "
commands(2) = "
@2@Open
&Copy"
commands(3) = "
@3@&
;View"
commands(4) = "
@4@&
;Properties"
'Set properties on dialog object
With myDlg
.NRTDMS = dms 'A handle to a valid ManDMS object
.SingleSel = False
.CommandList = commands
.ShowContainedDocuments = searchparams ' A handle to a valid IManProfileSearchParameters Collection Object
.Show hHandle
End With
You may get the search parameters from the IManSearchParameters Context Item from the searchcmd, like so:
...
If .Status = (.Status And nrActiveCommand) Then
.Execute
Dim brefresh
Dim searchparams As IManProfileSearchParameters
brefresh = context("IManExt.Refresh")
If True = brefresh Then 'command executed successfully
' Get search parameters entered by user
Set searchparams = context("IManSearchParameters")
End If
End If
NOTE: See Using WorkSite Dialogs.pdf in your installed SDK (under iHelp folder) for further detail on the DocOpenDlg Object.