Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / November 2007

Tip: Looking for answers? Try searching our database.

Dialogs(wdDialogEditReplace).Show

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Richard - 11 Nov 2007 16:18 GMT
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
Doug Robbins - Word MVP - 11 Nov 2007 19:48 GMT
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:

Signature

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

>I hope this is the right newsgroup, if not please point me in the right
>direction.
[quoted text clipped - 25 lines]
>
> Richard
Richard - 12 Nov 2007 18:43 GMT
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

> Tell us what you are really trying to do, rather that how you have not
> been able to achieve it.
[quoted text clipped - 38 lines]
>>
>> Richard
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.