Results 1 to 3 of 3
  1. #1
    3 Star Lounger
    Join Date
    Mar 2003
    Elkins Park, Pennsylvania, USA
    Thanked 0 Times in 0 Posts

    Built-in Dialog Boxes (Word XP)

    Hi, all. This week, Word is giving me a hard time with built-in dialog boxes.
    My goal was to write a simple piece of code that would throw up the "Insert Cross Reference" dialog box with some of the options already set. Because of the nature of our documents (and the skill levels of the users), I wanted it to have pre-selected to insert only the label and number of a "Table" reference, without a hyperlink; all the user would have to do would be to select the desired Table and click OK.
    I wrote the following piece of code (based on previous successes in Word 97), which apparently does nothing but reset all the values to the defaults (i.e. Reference type="Numbered Item" and Insert reference to="Page Number." In fact, the only thing I seem to be able to preset at all is whether I want it hyperlinked.
    Any ideas?

    Sub junk()
    Dim crDlg As Dialog
    Set crDlg = Dialogs(wdDialogInsertCrossReference)
    With crDlg
    .ReferenceType = "Figure"
    .ReferenceKind = wdOnlyLabelAndNumber
    .InsertAsHyperlink = 0
    End With
    End Sub
    <font face="Comic Sans MS">That's what you do in a herd; you look out for each other!</font face=comic> - Mike

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Thanked 31 Times in 31 Posts

    Re: Built-in Dialog Boxes (Word XP)

    Perhaps you can use SendKeys - it's reputed to be flaky, but it usually works to set presets in dialogs. I can't tell you the exact keys to use since I have a foreign-language version of Word, but I'll give you what I have and explain its parts. Before .Display, insert

    SendKeys "%tf{enter}%k{down}{enter}"

    %t = Alt+t, activates the Reference Type dropdown box (replace t by the accelerator key in the English version)
    f = select item beginning with f
    {enter} = confirm selection
    %k = Alt+k, activates the Reference Kind dropdown box (replace k by the accelerator key in the English version)
    {down} = press down arrow once to get to Only Label and Number (use as many times {down} as necessary)
    {enter} = confirm selection

  3. #3
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Silicon Valley, USA
    Thanked 94 Times in 90 Posts

    Re: Built-in Dialog Boxes (Word XP)

Posting Permissions

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