[Return to contents]
Last updated: before December, 1998
Paul Bent submitted the following script, saying:
At http://XpertSS.com we were asked recently how to trigger a script when a named find is run from the list in the Action Bar.
Well there is no such event but you can hide the Action Bar and substitute a drop down list box containing the named finds. A script or macro can then run the find on data change in the drop down box.
Sub NewFindList Dim aFinds As Variant, UB As Integer, aFStr() As String, C As Integer 'We need an array of variants to get the named finds then a string array to set the list from aFinds = CurrentDocument.NamedFindSorts UB = Ubound(aFinds) 'Now we know how many so resize an array of strings. We need 'data type string to use the SetList method. Redim aFStr(UB) 'Load the strings into the array For C = 0 To UB aFStr(C) = aFinds(C) Next 'Populate a dropdown box list with the string array. 'The dropdown box is named FList and is unbound. When I created it I 'had to type z as the first list item because an empty list is not allowed at creation. CurrentView.Body.FList.SetList(aFStr) End Sub
Sub Change(Source As Dropdownbox) If CurrentView.Body.Flist.Text = "" Then Goto ExitSub CurrentWindow.NamedFindSort = CurrentView.Body.Flist.Text ExitSub: End Sub
Sub Click(Source As Button, X As Long, Y As Long, Flags As Long) If CurrentView.Body.Flist.Text = "" Then Goto ExitSub CurrentWindow.NamedFindSort = CurrentView.Body.Flist.Text ExitSub: End Sub