Results 1 to 4 of 4
  1. #1
    Gold Lounger
    Join Date
    Dec 2000
    Location
    Hollywood (sorta), California, USA
    Posts
    2,759
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Adding Autotext (Word 97SR2)

    When using

    oAutoTextTemplate.AutoTextEntries.Add Name:=sATName, Range:=aRng

    to add an new autotext entry, how is the style assigned to the autotext determined?

    I have tried aRng.Style = ("Preferred Style"). Doesn't work.
    Kevin <IMG SRC=http://www.wopr.com/w3tuserpics/Kevin_sig.gif alt="Keep the change, ya filthy animal...">
    <img src=/w3timages/blackline.gif width=33% height=2><img src=/w3timages/redline.gif width=33% height=2><img src=/w3timages/blackline.gif width=33% height=2>

  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: Adding Autotext (Word 97SR2)

    Hi Kevin,

    Haven't tried it; but probably the style is picked up from the Range?

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

  3. #3
    Super Moderator
    Join Date
    Jan 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    3,852
    Thanks
    4
    Thanked 259 Times in 239 Posts

    Re: Adding Autotext (Word 97SR2)

    There are two methods for creating an autotext entry. It appears one of these allows you to specify the style. The other uses the style of the first paragraph in the range
    <pre> Dim aRng As Range
    Set aRng = Selection.Range
    'works with a range and uses the style of the first paragraph
    ActiveDocument.AttachedTemplate.AutoTextEntries.Ad d Name:="AT entry 1", Range:=aRng
    'works with a selection and will take the stylename as shown
    Selection.CreateAutoTextEntry "AT entry 2", "Heading 1"</pre>

    I would stick with the first one but the other one might be bendable to your requirements.
    Andrew Lockton, Chrysalis Design, Melbourne Australia

  4. #4
    Gold Lounger
    Join Date
    Dec 2000
    Location
    Hollywood (sorta), California, USA
    Posts
    2,759
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Adding Autotext (Word 97SR2)

    Andrew,

    Thanks for helping out here. I've been experimenting with the first technique by assigning
    the style one of three ways:

    aRng.FormattedText.Style = "P-Spell Outs"
    aRng.Paragraphs(1).Style = "P-Spell Outs"
    aRng.Style = "P-Spell Outs"

    then the ol':

    oAutoTextTemplate.AttachedTemplate.AutoTextEntries .Add Name:=sATName, Range:=aRng

    At first, none of these appeared to work. But if I change the style on a blank doc to "P-Spell Outs",
    then click Insert>Autotext, I see all the "P-Spell Outs" in the list. Ok, fine.

    So, maybe my next problem is an altogether different animal. When the current style is NOT
    "P-Spell Outs" and I click Insert>Autotext, I see the stylename "P-Spell Outs" with the popup
    indicator ►. When I click that, I'm supposed to see the list of "P-Spell Outs" autotext entries, correct?

    What I see is one of my custom sub menus from the app menu on the Menu Bar. Very weird...

    Anyway, the second technique you mention seems like a contradiction. The selection object already
    has a style assigned to it, by virtue of the fact that it's in a paragraph, yes? So, I can override that
    by specifying a style of my choice? Ok. I guess I'll give it a try just to be thorough.

    Any idea why clicking an AutoText category on the Insert>Autotext popup reveals a custom menu???
    Kevin <IMG SRC=http://www.wopr.com/w3tuserpics/Kevin_sig.gif alt="Keep the change, ya filthy animal...">
    <img src=/w3timages/blackline.gif width=33% height=2><img src=/w3timages/redline.gif width=33% height=2><img src=/w3timages/blackline.gif width=33% height=2>

Posting Permissions

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