Results 1 to 10 of 10
  1. #1
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Morden, Surrey, United Kingdom
    Posts
    1,838
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Searching Autotext entries (Word 2003 onwards)

    Does anyone know if it's possible to search an autotext collection for a specific string, and actually search the whole text of each entry (as opposed to just the first 255 characters), and if so will it do so without truncating/deformatting the entry?

    I'd have to write the search function to find out and I don't actually know how to do that yet so I thought I'd ask first ...
    Beryl M


  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Searching Autotext entries (Word 2003 onwards)

    I think you already know the answer:

    - Create a blank new document.
    - Loop through the autotext entries, and for each entry:
    - Clear the new document.
    - Insert the entry.
    - Search for the specific string.

    What happens then depends on what you want to do if/when the string is found.

  3. #3
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Morden, Surrey, United Kingdom
    Posts
    1,838
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Re: Searching Autotext entries (Word 2003 onwards)

    Sigh. Well, I had to ask!
    Beryl M


  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Searching Autotext entries (Word 2003 onwards)

    It's the only way - Microsoft hasn't provided any way to get at the contents of an AutoTextEntry directly. It would be too complicated, since an AutoTextEntry is not a string, it is a representation of a Range object that may contain text, tables, graphics, controls, page setup, etc. So in order to manipulate an AutoTextEntry, you have to turn it into a Range object, you can then use all methods that Word has for manipulating ranges.

  5. #5
    Platinum Lounger
    Join Date
    Nov 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    5,016
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Searching Autotext entries (Word 2003 onwards)

    That explanation (and I'm sure you're right) bothers me. If all the information required to "construct" an autotext entry into a document is stored in a template, then surely there must be a way to independently extract said info and reconstruct the autotext - as (text-based) RTF for instance. It seems that the real problem is MS not documenting the information that would enable one to program such a task.

    Alan

  6. #6
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Searching Autotext entries (Word 2003 onwards)

    It's not (just) a matter of missing documentation, there is nothing in the Word object model that lets you import, export or manipulate AutoTextEntries, except for 1) inserting into a range in a document, and 2) adding from a range in a document. No hidden methods either.

  7. #7
    Platinum Lounger
    Join Date
    Nov 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    5,016
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Searching Autotext entries (Word 2003 onwards)

    I realize that not much is provided (exposed by the object model) by winword in the way of autotext methods. I was thinking beyond that, dissecting the template by means independent of winword itself.

    Alan

  8. #8
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Searching Autotext entries (Word 2003 onwards)

    That should be possible, but I doubt it would be easier or less work than inserting an autotextentry into a document, inspecting/amending it, then adding it to the autotextentries collection again, especially for someone (like me) who isn't very familiar with manipulating binary or RTF files.

  9. #9
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Morden, Surrey, United Kingdom
    Posts
    1,838
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Re: Searching Autotext entries (Word 2003 onwards)

    Sounds fascinating, Alan, especially if it's possible, but I don't know any programming other than VBA (and as Hans will tell you, not always so much of that!), so it'll have to be explained as to an idiot if it uses anything else!

    Having said that, do go on ...?!
    Beryl M


  10. #10
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Searching Autotext entries (Word 2003 onwards)

    Beryl,

    I'm getting confused by having two threads about the same subject running simultaneously. I'm going to lock this one, and ask everybody who wants to help to post replies in the thread beginning at <post:=727,662>post 727,662</post:>.

Posting Permissions

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