PDA

View Full Version : Solved: Closing a built-in dialog box



evamads
01-21-2011, 06:52 AM
I have this code, which shows til dialog box for Cross references, but I want til dialog box to close, when the user have selected one cross reference. I have tries with .Show TimeOut:=9000, but that will cause the user to wait, and I don't like that.

Any suggestions?

With Dialogs(wdDialogInsertCrossReference)
.referencetype = "slutnote" 'Word 2010 Danish version
.referencekind = wdEndnoteNumber
.referenceitem = "1"
.insertashyperlink = 1
.insertposition = 1
.Show
End With

I use Word 2010 and Windows 7

/evamads :banghead:

fumei
01-21-2011, 10:01 AM
If I understand correctly:

You want it to close as soon as a selection is made. Yes?

User takes 30 seconds to make a selection. As soon as they do, it closes.

User takes 5 seconds to make a selection. As soon as they do, it closes.

Nope. Sorry. This is not possible. There is no real-time monitoring of what the user is doing, nor of what is (or is not) selected, if any.

evamads
01-22-2011, 08:15 AM
Yes, correct.

The dialog box has two buttons: Insert and Close.
I want the dialog box to close after the user hits the Insert button.

/evmad

Paul_Hossler
01-22-2011, 03:04 PM
As far as I know, Word doesn't work like that. Insert Cross reference dialog stays open until closed so that the user can insert more than one, or one multiple places

1. You could write your own user form and make Insert work the way you want

2. A Cross Reference is really just a REF field, so maybe you could make a 'One at a Time' macro to insert fields like {REF xref1234 /h}

Paul

fumei
01-24-2011, 10:04 AM
Paul: "As far as I know, Word doesn't work like that. "

Yup. The dialog waits for user closing - for the reason stated. The ability for multiple inputs.

So, the answer is as stated. This is not possible natively. There is no real-time monitoring the of the dialog object status. It has no way of "knowing" the user has selected anything.

Yes, you could make your own "dialog" using a userform. In fact, it is this kind of functionality that is one of the main reason there ARE userforms.