Results 1 to 6 of 6
  1. #1
    New Lounger
    Join Date
    Aug 2001
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Autotext for attached template (Word 97 Sr2)

    I'd like, but haven't been able to figure out, to be able to either have a toolbar button, or an Auto macro that will automatically change the Tools - Autocorrect - Autotext tab - Look In field to the attached template (or a specified global template), rather than the default 'All Active Templates'.

    Can anyone tell me if there is a automated way of doing this? I've looked at the dialog settings but can't find anything...

    Thanks

  2. #2
    Super Moderator
    Join Date
    Dec 2000
    Location
    New York, NY
    Posts
    2,970
    Thanks
    3
    Thanked 29 Times in 27 Posts

    Re: Autotext for attached template (Word 97 Sr2)

    Just to confirm, it looks like you can't do this. The available arguments for the wdDialogToolsAutoCorrect are:

    InitialCaps, SentenceCaps, Days, CapsLock, ReplaceText, Formatting, Replace, With, Add, Delete, SmartQuotes, CorrectHangulAndAlphabet, ConvBrackets, ConvQuotes, ConvPunct, ReplaceTextFromSpellingChecker

    - none of which appear to address what you need.

    It seems like your only option to get the functionality you want would be to build your own custom autotext dialog - no small project.

    Gary

  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: Autotext for attached template (Word 97 Sr2)

    In theory, you can set the template (.Context) for the wdDialogEditAutoText dialog, but in fact, it doesn't work when popping up the dialog, as you have discovered. Because the drop down menu is "sticky," you know Word is saving your last selected context somewhere, and you would think that it might be possible to find it and manipulate it. However, I don't have any idea where that would be (e.g., in memory only, in the registry, etc.). To try to pre-set the dialog, you might actually have to insert an innocuous AutoText somewhere (and immediately undo). Didn't test it myself...

  4. #4
    Super Moderator
    Join Date
    Dec 2000
    Location
    New York, NY
    Posts
    2,970
    Thanks
    3
    Thanked 29 Times in 27 Posts

    Re: Autotext for attached template (Word 97 Sr2)

    Jefferson,

    Thanks, didn't even know about that dialog.
    What syntax are you using to test applying the .Context property? - I can't anything to work without a runtime error.

    Gary

  5. #5
    Super Moderator
    Join Date
    Dec 2000
    Location
    New York, NY
    Posts
    2,970
    Thanks
    3
    Thanked 29 Times in 27 Posts

    Re: Autotext for attached template (Word 97 Sr2)

    Something very strange going on here:

    I got it to run using syntax like this:

    .Context "MyTemplate.dot (global template)"

    - but as you said, it did not reflect that template selection in the dialog itself.

    I then reran the code, but got a runtime error: "Object doesn't support this property or method.

    Then I commented out the ".Context" statement, and just ran the dialog .Show part.

    The dialog opened, and MyTemplate.dot was selected!!! <img src=/S/spook.gif border=0 alt=spook width=15 height=15>

  6. #6
    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: Autotext for attached template (Word 97 Sr2)

    I was guessing based on the WordBasic documentation for the WordBasic.InsertAutoText command that ".Context = 1" would refer to the attached template. Using "2" didn't change the dialog either.

    Hmmm... maybe this could be made to work with the WordBasic object? {Much research}

    No, this code yields the identical result:

    Dim dlg As Object
    Set dlg = WordBasic.DialogRecord.EditAutoText
    WordBasic.CurValues.EditAutoText dlg
    dlg.Context = 1
    WordBasic.Dialog.EditAutoText dlg

    (The last line should be changed to a function format to avoid an error on Cancel, but since it doesn't work anyway, I haven't done that extra work.)

    Incidentally, the syntax for the WordBasic object's dialogs is illustrated in this article <A target="_blank" HREF=http://www.f-prot.com/~bontchev/papers/upconv.html#References>The "Pros" and "Cons" of WordBasic Virus Upconversion</A>. Scroll down to Appendix A for examples.

Posting Permissions

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