Results 1 to 6 of 6
  1. #1
    Plutonium Lounger
    Join Date
    Nov 2001
    Posts
    10,550
    Thanks
    0
    Thanked 7 Times in 7 Posts

    Show Word builtin modeless dialog box (Word 2000)

    I need to display the InsertCrossReference dialog box from within a Word Macro. I used
    <pre>Dialogs(wdDialogInsertCrossReference).Show
    </pre>


    to do this. I have two problems with the behaviour of this dialog box, and I suspect that I can't do anything about either of them.

    1. <LI>I can't display this dialog box as Modeless, even though word normally does if you select it from the menu. When I display this box it is always Modal
      <LI>when I switch the view to Headers it spends a LONG time building up the list box - several minutes for a complex 300 page document, if I display the same dialog box from the Insert menu then the listbox displays instantly
    Any suggestions?

    StuartR

  2. #2
    5 Star Lounger
    Join Date
    May 2001
    Location
    Stuttgart, Baden-W, Germany
    Posts
    931
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Show Word builtin modeless dialog box (Word 2000)

    Hi Stuart,

    Does CommandBars.FindControl(ID:=775).Execute work better?

    <img src=/S/cheers.gif border=0 alt=cheers width=30 height=16>Klaus

  3. #3
    Plutonium Lounger
    Join Date
    Nov 2001
    Posts
    10,550
    Thanks
    0
    Thanked 7 Times in 7 Posts

    Re: Show Word builtin modeless dialog box (Word 2000)

    Thank you very much. This does just what I need.

    How did you find the magic number 775?
    How reliable is the 775 for use with other language variants of Word?
    Is there any easy way to check that it is the correct control?
    I can't just check the caption since that definitely changes in other countries.

    StuartR

  4. #4
    Gold Lounger
    Join Date
    Dec 2000
    Location
    New Hampshire, USA
    Posts
    3,386
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Show Word builtin modeless dialog box (Word 2000)

    Using ID numbers is not a reliable method as the number may change between Word versions, perhaps between lanuage versions.

  5. #5
    Plutonium Lounger
    Join Date
    Nov 2001
    Posts
    10,550
    Thanks
    0
    Thanked 7 Times in 7 Posts

    Re: Show Word builtin modeless dialog box (Word 2000)

    I suspected that the ID number may not be reliable. I can release a new template for new Word versions, I have different templates for Word97 and Word2000 already, but I do need to be do the right thing in multiple languages (including some very strange ones, not just European).

    If I iterate across all the controls with a for each loop, can anyone think of a property that would confirm that this is the Insert Cross Reference... menu item?

    StuartR

  6. #6
    5 Star Lounger
    Join Date
    May 2001
    Location
    Stuttgart, Baden-W, Germany
    Posts
    931
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Show Word builtin modeless dialog box (Word 2000)

    Hi Stuart,

    I put the Command into the Menu Bar to the left of "File" temporarily, and then ran
    MsgBox Application.CommandBars.ActiveMenuBar.Controls(1). ID

    While I agree with Howard that you should use constants instead of concrete ID numbers whenever possible, this is difficult if Microsoft doesn't support it. Many of the newer dialogs, for example, don't have wdWordDialog constants, so you either have the choice to not use these dialogs, or to use numbers (and live in eternal fear that they may change).

    Sometimes, Microsoft seems to even make changes if they have assigned a constant <img src=/S/bummer.gif border=0 alt=bummer width=15 height=15>
    Application.Dialogs(wdDialogEditGoToOld).Show
    brings up the "Extended Formatting" toolbar in Word2000.

    On the other hand, the numbers for the controls seem to be the same for different language versions, and rarely change with new versions. If your user base is small, you might risk it.

    Iterating the controls or using .FindControl surely is preferable, if you can make it work (I couldn't). Since the .Caption and the .DescriptionText properties of the control are different in every language version, I wouldn't even know what to look for.

    <img src=/S/cheers.gif border=0 alt=cheers width=30 height=16>Klaus

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •