PDA

View Full Version : setting hidden checkbox on wdDialogEditFind



tlangford
05-26-2008, 04:29 AM
Hi.

In a word doc I'm able to show the wdDialogEditFind dialog, but I'd like to automatically check the 'Hidden' checkbox when it's shown.

I can't seem to find a property list for this built-in dialog anywhere, and the examples given in the standard Help don't give me any pointers.

The code I have so far is...

Dim findDialog As Dialog
Set findDialog = Dialogs(wdDialogEditFind)
' would like to set the Hidden text checkbox here
findDialog.Show

fumei
05-26-2008, 10:47 AM
What version are you using? You should always mention version.

I see no "Hidden text" checkbox in Word 2002 (XP). Even running your code to display the Dialog, I see no "hidden" checkbox.

tlangford
05-26-2008, 10:59 AM
Hi again Fumei..

Sorry, I'm using Word 2003. On the wdDialogEditFind, it's the checkbox under More (if it's not already showing the expanded Find dialog), then Format and Font.

It's the Hidden checkbox in the Effects section I'm trying to check through VBA.

fumei
05-26-2008, 11:32 AM
You need to set this as a property of Selection.Find first. You can not set it as a property of the Dialog...because it is NOT a property of the Dialog. It should work like this:


Dim findDialog As Dialog
Set findDialog = Dialogs(wdDialogEditFind)

Selection.Find.ClearFormatting
With Selection.Find
.Format = True
With .Font
.Hidden = True
End With
End With

findDialog.Show


The dialog will now display with Hidden = True as a property of Selection.Find, which is, in fact, what is being used with your dialog.

That is, your dialog uses the properties of Selection.Find, so it is there that you must make settings.

Note: this is also on 2002. I just did not understand what you were saying.

tlangford
05-26-2008, 11:38 AM
Brilliant! Do they operate kudos points on this site? You'd get some from me!

fumei
05-26-2008, 12:07 PM
No kudo points. Expressed thanks are always welcomed though. You can use the Rate Thread to give it a rating (in your opinion) if you want.

I would like to point out a process that may help in the future.

Did you try to record a macro changing the Find settings? That is, recording a macro to open the Find dialog, click the More, go into Font, check the Hidden box, then OK out?

If you did, you would notice that...your changes to check Hidden do NOT show up in the recorded macro.

This is actually a clue. It means that the object affected by the change is NOT the object you are recording.

You would be recording actions for the Find dialog object. But changing the Selection.Find object. While the actions changing Selection.Find are indeed actioned, they will NOT be part of the recorded macro.

fumei
05-26-2008, 12:09 PM
Oh, and you should mark this thread as Solved.