Results 1 to 7 of 7
  1. #1
    3 Star Lounger
    Join Date
    Mar 2001
    Location
    Silicon Valley, California, USA
    Posts
    273
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Display Dialog with Different Defaults

    Hi Everbody (I also posted this in VB /VBA forum),

    In Word 2000, I attached the following code block to a toolbar button. The idea is, when the user clicks the button, they get the insert cross reference dialog, with various settings already set. According to the help file, this code should work. However, when I click the button, either I get the standard defaults for Word, or I get the last settings that I chose manually when I used the dialog last. What gives? Thanks!

    With Dialogs(wdDialogInsertCrossReference)
    .ReferenceType = "Numbered item"
    .ReferenceKind = wdNumberFullContext
    .InsertAsHyperlink = False
    .Update
    .Show
    End With

    Jim

  2. #2
    crudd
    Guest

    Re: Display Dialog with Different Defaults

    change your .show to a .display and then call a .execute

  3. #3
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Display Dialog with Different Defaults

    That doesn't work for me. The only property assignment that seems to work is

    .InsertAsHyperlink = False

    I played with the other arguments, substituting random strings and numbers. Not only did the behavior of the dialog not change, no errors were raised. Is it possible they are read-only?

    Jim, maybe read the values out and display them in your own UserForm? One benefit: the user cannot play with the drop-down lists.

  4. #4
    3 Star Lounger
    Join Date
    Mar 2001
    Location
    Silicon Valley, California, USA
    Posts
    273
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Display Dialog with Different Defaults

    Crudd - Thanks for the idea. However, doing that still doesn't start with the choices I want as defaults, and you get a runtime error (Command failed) at the .Execute (see further details in response to jscher2000). I only want to display it and let the user decide what to pick in the list of numbered items, I don't want to fully automate the insertion of a cross reference. Also, as for Display versus Show, the Help says under Display, "Use the Show method to display a dialog box and ... apply settings."

    jscher2000 - Thanks for the suggestions. It may very well be that the arguments are read-only; I can get the current settings using the arguments. Some of the examples in the help file of using arguments to set values do work (like one for setting the "keep lines together" checkbox). Here is another clue: the simple line

    Dialogs(wdDialogInsertCrossReference).Execute

    Causes runtime error (Command failed). There is no logical reason for it to fail, because if I open the dialog manually and immediately press Insert, the cross reference is inserted, no problem. If the Execute is not supported, I suppose it is a stretch to expect the arguments to be supported as write-able.

    As for getting the values and populating my own dialog, that's a good suggestion, but I am trying to provide a simple convenience rather than impose a restriction; the circle of users is very small, and in the same room.

    I'll just have to write more detailed instructions for the other users ("Choose 'paragraph number (full context)...' ").

    Thanks!

  5. #5
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Display Dialog with Different Defaults

    Jim, if a kludge is good enough, perhaps you could pop the dialog open and use SendKeys to set the right options.

  6. #6
    Star Lounger
    Join Date
    Apr 2003
    Location
    Kansas City, Missouri
    Posts
    66
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Display Dialog with Different Defaults

    I am happy to see that I am not the only person to have experienced this difficulty (even if the original post is 2 years old).

    jscher, I presume that your suggestion to kludge with SendKeys means sending T and then tabbing to the next field? That's something I may have to consider and hope that the user didn't define several caption labels. Every search I have conducted on this particular dialog indicates that Jim's original code *should* have worked. As other reported, I have not received any errors myself.

    Has anyone ever found a workable solution to this problem? As it is now, I can offer a buton to open the Caption dialog, which is only one click more useful than going to Insert|Cross-Reference.

    Kevin Elmore

  7. #7
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Display Dialog with Different Defaults

    During the past two years, I've found that dialogs that "stay open" are especially resistant to automation. I haven't learned any cross-reference secrets during that time. Sorry.

Posting Permissions

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