Exception

S

scorpion53061

This code produces an error when attempting to close the dialog in word....

An unhandled exception of type 'System.Runtime.InteropServices.COMException'
occurred Additional information: Word has finished searching the document.

What can I do to avoid it?

' With oDoc.Application.Dialogs(CInt(Word.WdWordDialog.wdDialogEditFind))
'.Show()
'End With
 
J

Jezebel

1. Probably doesn't matter, but the argument to Dialogs should be a long,
not an integer: wdDialogEditFind is the right data type already, so
converting it to an integer can't help any.

2. Remove the () after the show statement. The Show argument, if provided,
is the TimeOut value -- you're providing this as an empty value, which, if
it evaluates to zero, is likely to confuse the poor darling. It might help
also to catch the return value from the Show statement:

Dim pResult as long
pResult = oDoc.Application.Dialogs(wdDialogEditFind).Show
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top