Results 1 to 5 of 5

Thread: Return Word wdDialogEditFind options

  1. #1

    Thread Starter
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,427

    Return Word wdDialogEditFind options

    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

  2. #2
    PowerPoster jdc2000's Avatar
    Join Date
    Oct 2001
    Location
    Idaho Falls, Idaho USA
    Posts
    2,393

    Re: Return Word wdDialogEditFind options

    Maybe:

    Code:
    wdDialogEditFind.Find
    https://docs.microsoft.com/en-us/off...rd.dialog.show

  3. #3

  4. #4
    PowerPoster
    Join Date
    Nov 2017
    Posts
    3,116

    Re: Return Word wdDialogEditFind options

    https://docs.microsoft.com/en-us/off...ent-lists-word

    dlgFind.MatchCase
    dlgFind.WholeWord
    dlgFind.PatternMatch (for the Use Wildcards checkbox)
    dlgFind.SoundsLike

    etc...

  5. #5
    PowerPoster
    Join Date
    Nov 2017
    Posts
    3,116

    Re: Return Word wdDialogEditFind options

    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.

    Code:
    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
    Edit: I got it to return the proper state of PatternMatch and SoundsLike only when a search found a result in the document. YMMV
    Last edited by OptionBase1; Jul 23rd, 2020 at 06:49 PM.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width