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

    Autotext and Associated Style (Word 97SR2)

    We all know (thanks to Woody, et.al.) that Autotext entries are always orgainized by the paragraph style applied when they are created.

    The question is if you've got autotext created with the *wrong* underlying style is there an easy way to re-associate the autotext with another style?

    I want to organize hundreds of autotext entries that were created with the Normal style without having to insert each one into a paragraph of the new style, select the text then add the autotext entry.

    Sounds like maybe some VBA code would do it, but I thought I'd try here first. (After Klaus showed me up with his elegantly simple solution to changing the Line Number font, I'm playing it safe.) <img src=/S/clever.gif border=0 alt=clever width=15 height=15>
    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: Autotext and Associated Style (Word 97SR2)

    Hi Kevin,

    The only way I found is to automate the process you described. Perhaps there is a better solution, but if so, it has escaped me...

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

    <pre>Sub AutoTextNewStyle()
    Dim myAT As AutoTextEntry
    Dim RememberStyle
    RememberStyle = Selection.Style
    ' Style to change the AutoTexts to:
    Selection.Style = "Body Text"
    For Each myAT In NormalTemplate.AutoTextEntries
    ' Style the AutoTexts are in:
    If myAT.StyleName = ActiveDocument.Styles("Normal") Then
    ' Safer if it's a built-in style (->different language versions):
    ' If myAT.StyleName = _
    ' ActiveDocument.Styles (wdStyleNormal).NameLocal Then
    Selection.InsertAfter myAT.Value
    NormalTemplate.AutoTextEntries.Add _
    Name:=myAT.Name, Range:=Selection.Range
    Selection.Delete
    End If
    Next myAT
    Selection.Style = RememberStyle
    End Sub</pre>


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

    Re: Autotext and Associated Style (Word 97SR2)

    Ok, since I now have to go-ahead (if you say automating is the only way, I believe you) I'll create a little form-based utility to make the changes. Not all the Normals get moved to another single style, so I'll have to use a multi-select list box to select the AT entries then an Apply button to run your suggested code.

    Some day, maybe, I'll get to this and post back a little freebie util.
    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>

  4. #4
    Silver Lounger Charles Kenyon's Avatar
    Join Date
    Jan 2001
    Location
    Sun Prairie, Wisconsin, Wisconsin, USA
    Posts
    2,049
    Thanks
    124
    Thanked 119 Times in 116 Posts

    Re: Autotext and Associated Style (Word 97SR2)

    Hi Kevin,

    I used to have a template to organize AutoText but lost it in an office move. I'm in the process of reconstructing it but it isn't done yet. When I did the original, I wasn't taking into account styles at all.

    What I have right now is a five-column table with the following headings:
    Entry Name | Style | AutoText Field | AutoText Result | notes

    My previous template had three columns (not the style or notes columns). The field column had an actual AutoText field (not AutoTextList) to display the live AutoText entry. The results column was also the desired AutoText Entry column.

    I could type in the AutoText entry names in column 1, then run a macro that filled in the field and results columns based on the entry name in column 1.

    Finally, I could make changes in the results column or add additional AutoText entries to the table. A macro would run through and recreate the AutoText entries in the template based on the name in column 1 and the text in column 3. It would then update the fields in column 2.

    I'm trying to put together the same thing where the style name is in column 2 and there is are macros that:

    (1) determine the style name of existing AT entries and puts that name in. (Don't have a clue how to do this, but I can dream.)

    (2) Apply the style named in column 2 to the text in column 4.

    (3) Recreate AT entries using the names in column 1 and the text in column 4.

    Among other things, this would allow sorting the table by style name for putting together style-specific menus. One problem is some of my odd AT entries that are position-specific or otherwise don't fit in a table very well (or are actual tables themselves).

    Like I said, I'm not even close to done with this, but I thought I would share my thoughts on how I was going to go about it. If I get it done soon, I'll let you know and share. Hope this helps.
    Charles Kyle Kenyon
    Madison, Wisconsin

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

    Re: Autotext and Associated Style (Word 97SR2)

    Charles,

    I'm finally paying some attention to my autotext woes and am revisiting posts from the past. Yours is especially interesting in that I think your little util is a good idea.

    However, I'm getting so fed up with autotext that I'm seriously thinking of pitching it altogether and writing an interface to bookmarked text in .atx files (my own invention). Each template would then have an associated .atx file. The inline spell-out functionality (type the first 4-5 chars and press Enter business would be replaced by a macro: Alt-Something prompts for the name.

    If you ever get to the testing stage and need a hand, let me know.
    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>

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

    Re: Autotext and Associated Style (Word 97SR2)

    Klaus,

    I clipped your code, abbreviated it to meet my needs and have my autotext "spell-outs" all cleaned up. Thanks for pointing me in the right direction.

    Sub AutoTextStyleAssign()

    Dim aT As AutoTextEntry
    'Style to change the autotexts to:
    Selection.Style = "P-Spell Outs"
    For Each aT In ThisDocument.AttachedTemplate.AutoTextEntries
    'Style the autotexts are in:
    Debug.Print aT.Name & " : " & aT.StyleName
    If Left$(aT.Name, 1) = "x" And aT.StyleName <> "P-Spell Outs" Then
    Selection.InsertAfter aT.Value
    ThisDocument.AttachedTemplate.AutoTextEntries.Add _
    Name:=aT.Name, Range:=Selection.Range
    Selection.Delete
    End If
    Next aT

    End Sub
    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
  •