[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 409
  • Last Modified:

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.  
0
rexswain
Asked:
rexswain
  • 4
  • 3
1 Solution
 
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
 
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
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
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 did not find a solution to this question, and I got tired of nagging email from EE, so I am closing it.
0
 
rexswainAuthor Commented:
I have run into this problem again, so I am reopening the question in hopes of an answer...
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now