Computer Forum Forum Index
Register  FAQ Profile Log in to check your private messages Log in Register 

Dialogs(wdDialogEditReplace).Show

 
Post new topic   Reply to topic    Computer Forum Forum Index -> microsoft word programming
View previous topic :: View next topic  
Author Message
Richard
Guest





PostPosted: Sun Nov 11, 2007 4:18 pm    Post subject: Dialogs(wdDialogEditReplace).Show Reply with quote

I hope this is the right newsgroup, if not please point me in the right
direction.

Could anyone tell me why Dialogs(wdDialogEditReplace).Show works but
MsgBox Dialogs(wdDialogEditReplace).Show doesn't (raising error 5524, which
as far as I can gather is undocumented)?

Which leads me to the $xxxx dollar question: is there any way to
programatically retrieve the return value of .Show? (i.e. the button/action
the user performed)
All the code I've seen puts an On Error Resume Next before the .Show line,
which would suggest that the answer to above is 'No'!

Alternatively, is there a Win API workaround (possibly with callback
function) that calls Word's F&R dialog?

Before you ask, I've already tried all the very erratic Sendkeys ways of
calling Word's F&R dialog. Sendkeys with Ctrl-H from a Public Sub itself
called by a keybinding does not work, (Sendkeys Alt-e, e from same Public
Sub does, but some of my users have already remapped Alt-e for their own
purposes). I know I can .Execute my Selection.Find etc, but I really need to
be able to "intercept" it via the dialog. If there's no way of
programmatically "hooking in" to Word's F&R dialog, then I suppose the only
viable alternative is to create one's own dialog with a UserForm (kludgy and
slower at best, no?)?

Regards

Richard
Back to top
Google
Sponsor





PostPosted: Sun Nov 11, 2007 4:18 pm    Post subject: Advertisement

Back to top
Doug Robbins - Word MVP
Guest





PostPosted: Sun Nov 11, 2007 7:48 pm    Post subject: Re: Dialogs(wdDialogEditReplace).Show Reply with quote

Tell us what you are really trying to do, rather that how you have not been
able to achieve it.

On Error GoTo EndThis
With Dialogs(wdDialogEditReplace)
.Find = "Blue"
.Replace = "Red"
If .Show = 0 Then
MsgBox "The use did not execute the command"
End If
End With
EndThis:

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

"Richard" <rp@wot.fr> wrote in message
news:%23sA5u5HJIHA.2480@TK2MSFTNGP05.phx.gbl...
Quote:
I hope this is the right newsgroup, if not please point me in the right
direction.

Could anyone tell me why Dialogs(wdDialogEditReplace).Show works but
MsgBox Dialogs(wdDialogEditReplace).Show doesn't (raising error 5524,
which as far as I can gather is undocumented)?

Which leads me to the $xxxx dollar question: is there any way to
programatically retrieve the return value of .Show? (i.e. the
button/action the user performed)
All the code I've seen puts an On Error Resume Next before the .Show line,
which would suggest that the answer to above is 'No'!

Alternatively, is there a Win API workaround (possibly with callback
function) that calls Word's F&R dialog?

Before you ask, I've already tried all the very erratic Sendkeys ways of
calling Word's F&R dialog. Sendkeys with Ctrl-H from a Public Sub itself
called by a keybinding does not work, (Sendkeys Alt-e, e from same Public
Sub does, but some of my users have already remapped Alt-e for their own
purposes). I know I can .Execute my Selection.Find etc, but I really need
to be able to "intercept" it via the dialog. If there's no way of
programmatically "hooking in" to Word's F&R dialog, then I suppose the
only viable alternative is to create one's own dialog with a UserForm
(kludgy and slower at best, no?)?

Regards

Richard
Back to top
Richard
Guest





PostPosted: Mon Nov 12, 2007 6:43 pm    Post subject: Re: Dialogs(wdDialogEditReplace).Show Reply with quote

Thanks Doug, today it's working.
(i.e. If .Show = , Retval = .Show etc all work today, after shutting down
the computer last night, go figure!). That said, I'm still curious as to why
all the "MVP" code I've seen on the net puts On Error Resume Next before
calling this dialog, but no matter. "Ours not to reason why" apparently
(given the 'tone' of this newsgroup), ours but to say what we are trying to
do : - )

Talking of which, apart from the above (retrieving the return value of
..Show), I'm also trying to do the following:

1. Control wdDialogEditReplace, i.e. make it modeless. The .Show method
only takes Timeout as argument. There appears to be no way to make it
modeless (the Find tab is dimmed). I would like it to be modeless (as it is
when called by Word's user interface) to give the user the option of
clicking the Find tab (hence my query about possible Win API workarounds,
I'm still takers, should you know of one)

2. Configure wdDialogEditReplace before ".Show" ing it , i.e. force it to
show More (perhaps I could try a Sendkeys to automatically develop the
'More' options?). Since you are no doubt going to say "what are you trying
to do", I need to do this to prompt the user to consider whether or not they
need to check "Match case" and/or "Match whole word", which are critical
parameters in the translation-related routine I'm writing.

Of the two, number 1 (the modeless issue) is by far the most important to
me. Why is this dialog modal when called by code but modeless when called
"'normally" by the user? Where's the logic?

Thanks for any enlightenment

Richard


"Doug Robbins - Word MVP" <dkr@REMOVECAPSmvps.org> a écrit dans le message
de news: uCRXRvJJIHA.5904@TK2MSFTNGP04.phx.gbl...
Quote:
Tell us what you are really trying to do, rather that how you have not
been able to achieve it.

On Error GoTo EndThis
With Dialogs(wdDialogEditReplace)
.Find = "Blue"
.Replace = "Red"
If .Show = 0 Then
MsgBox "The use did not execute the command"
End If
End With
EndThis:

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

"Richard" <rp@wot.fr> wrote in message
news:%23sA5u5HJIHA.2480@TK2MSFTNGP05.phx.gbl...
I hope this is the right newsgroup, if not please point me in the right
direction.

Could anyone tell me why Dialogs(wdDialogEditReplace).Show works but
MsgBox Dialogs(wdDialogEditReplace).Show doesn't (raising error 5524,
which as far as I can gather is undocumented)?

Which leads me to the $xxxx dollar question: is there any way to
programatically retrieve the return value of .Show? (i.e. the
button/action the user performed)
All the code I've seen puts an On Error Resume Next before the .Show
line, which would suggest that the answer to above is 'No'!

Alternatively, is there a Win API workaround (possibly with callback
function) that calls Word's F&R dialog?

Before you ask, I've already tried all the very erratic Sendkeys ways of
calling Word's F&R dialog. Sendkeys with Ctrl-H from a Public Sub itself
called by a keybinding does not work, (Sendkeys Alt-e, e from same Public
Sub does, but some of my users have already remapped Alt-e for their own
purposes). I know I can .Execute my Selection.Find etc, but I really need
to be able to "intercept" it via the dialog. If there's no way of
programmatically "hooking in" to Word's F&R dialog, then I suppose the
only viable alternative is to create one's own dialog with a UserForm
(kludgy and slower at best, no?)?

Regards

Richard


Back to top
Display posts from previous:   
Post new topic   Reply to topic    Computer Forum Forum Index -> microsoft word programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Computer Forum