VBA code to query if a built-in Word dialog is open

I have an application that manipulates a Word document.  The twist is that Word and the document are visible to the user, who is supposed to be cooperating with us :-)  A problem came up: if the user brings up a built-in Word dialog, such as Text Form Field Options, and then switches over to my app and asks it to do something to the document, I get "80010001 Call was rejected by callee".

My question: is there a way to query Word and find out whether one of its built-in dialogs is pending?  I do not see any properties in the application or the document that seem relevant.  
rexswainAsked:
Who is Participating?
 
rexswainConnect With a Mentor Author Commented:
I did not find a solution to this question, and I got tired of nagging email from EE, so I am closing it.
0
 
Joanne M. OrzechManager, Document Services CenterCommented:
I see you haven't had any response so I'm going out on a limb here.... maybe:

If Dialogs.Count <> 0 Then
    MsgBox "A Dialog box is open"
End If

Open in new window

0
 
rexswainAuthor Commented:
Oooo that looked tempting.  But I'm afraid that Dialogs.Count reports the total number of built-in dialogs (250 on my system!), not just the ones that are open.

Interestingly, Word does know about this situation.   If you have a dialog open and  then use ActiveX to send the Quit method to the application, Word puts up a dialog saying:

You cannot close Microsoft Office Word because a dialog box is open.
Click OK, switch to Word, and then close the dialog box.
Too bad they don't allow me to query that situation.
0
Cloud Class® Course: Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

 
Joanne M. OrzechManager, Document Services CenterCommented:
Oh - sorry!  I was assuming again.... and you know what that does!!!  I've used that to find out if there's an ActiveDocument on the screen.... mea culpa.

I did find an article about dismissing dialog boxes.... http://support.microsoft.com/kb/259971


0
 
rexswainAuthor Commented:
Thanks for the link to the MS article.  But it assumes that you (the VBA process) opened the dialog box.  In my case, it's the "cooperating" end user (cue laughter) that may have opened the dialog.  

But thanks again for your efforts.  Judging by the deafening silence, this must be a difficult problem!
0
 
Joanne M. OrzechManager, Document Services CenterCommented:
Sorry I couldn't be of more assistance.... :(
0
 
rexswainAuthor Commented:
I have run into this problem again, so I am reopening the question in hopes of an answer...
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.