This code wiill display the Word Find dialog. How do I find out which options the user selected?
Code:Sub d()
Dim dlgFind As Dialog
Set dlgFind = Dialogs(wdDialogEditFind)
With dlgFind
.Display
End With
End Sub
Printable View
This code wiill display the Word Find dialog. How do I find out which options the user selected?
Code:Sub d()
Dim dlgFind As Dialog
Set dlgFind = Dialogs(wdDialogEditFind)
With dlgFind
.Display
End With
End Sub
Maybe:
https://docs.microsoft.com/en-us/off...rd.dialog.showCode:wdDialogEditFind.Find
Thanks but what I'm looking for is a way to capture the fact that 'Match Case' (and possibly other options) was chosen in this dialog.
Attachment 178025
https://docs.microsoft.com/en-us/off...ent-lists-word
dlgFind.MatchCase
dlgFind.WholeWord
dlgFind.PatternMatch (for the Use Wildcards checkbox)
dlgFind.SoundsLike
etc...
For the record, I'm using an older version of Word than you, since I have fewer checkboxes in my Search dialog.
This code worked as far as returning the accurate state of the Match case and Find whole words only checkbox provided that a search was done (if I changed the state of those checkboxes and then just clicked cancel the "updated" state of the checkbox was not properly returned).
That being said, I can't get it to return the proper state for PatternMatch or SoundsLike no matter what I tried.
Edit: I got it to return the proper state of PatternMatch and SoundsLike only when a search found a result in the document. YMMVCode:Private Sub CommandButton1_Click()
Dim dlgFind As Dialog
Set dlgFind = Dialogs(wdDialogEditFind)
With dlgFind
.Display
.Update
.Execute
End With
MsgBox dlgFind.MatchCase
MsgBox dlgFind.WholeWord
MsgBox dlgFind.PatternMatch
MsgBox dlgFind.SoundsLike
End Sub