locked
Autotext Migration to Word 2010 RRS feed

  • Question

  • I'm upgrading from Word 2003 to word 2010

     

    This Office.com article is VERY BAD:  it migrates EVERYTHING in Normal.dot over.

     

    http://office.microsoft.com/en-us/word-help/add-autotext-in-word-HA101827969.aspx

     

    I tried it and it migrated all the MACROS and FORMS in Normal.dot that were saved in Autotext.dotm,  which screwed up Word (particularly the QAT), so I manually deleted them using the Organizer, which seemed to solve the problem.  I believe the problem was that the macros and forms in Normal.dot had ALREADY been imported, so importing them again caused problems.

    So the question remains:  what's the best way to migrate autotext entries?

    Friday, July 8, 2011 8:53 PM

Answers

  • I would do the following:

    * Rename the normal.dot of Word 2003 to normal11.dot and copy it to the 2010 system.
    * Open the normal11.dot by doubleclicking it.
    * Press Alt-F11
    * Select TemplateProject Normal11 and create a new Module
    * Insert the following code:

    Sub CopyAutotext()
    Dim src As String
    Dim dst As String
    Dim tmpSrc As Template
    Dim tmpDst As Template
    Dim at As AutoTextEntry
    Dim rng As Range
    
      Set tmpSrc = ThisDocument.AttachedTemplate
      Set tmpDst = Application.NormalTemplate
      src = tmpSrc.FullName
      dst = tmpDst.FullName
      
      For Each at In tmpSrc.AutoTextEntries
        'Application.OrganizerCopy Source:=src, Destination:=dst, Name:=at.Name, Object:=wdOrganizerObjectAutoText
        Set rng = tmpSrc.AutoTextEntries(at.Name).Insert(Where:=Selection.Range, RichText:=True)
        tmpDst.BuildingBlockEntries.Add at.Name, wdTypeAutoText, "Import", rng
        rng.Delete
      Next at
      tmpDst.Save
      MsgBox "OK."
    
    End Sub
    

    * Run the code and you're done. The former Autotexts are now Building Blocks of the type "Autotext" in the category "Import".

    • Marked as answer by Max Meng Tuesday, July 19, 2011 2:23 AM
    Monday, July 11, 2011 12:33 PM

All replies

  • I would do the following:

    * Rename the normal.dot of Word 2003 to normal11.dot and copy it to the 2010 system.
    * Open the normal11.dot by doubleclicking it.
    * Press Alt-F11
    * Select TemplateProject Normal11 and create a new Module
    * Insert the following code:

    Sub CopyAutotext()
    Dim src As String
    Dim dst As String
    Dim tmpSrc As Template
    Dim tmpDst As Template
    Dim at As AutoTextEntry
    Dim rng As Range
    
      Set tmpSrc = ThisDocument.AttachedTemplate
      Set tmpDst = Application.NormalTemplate
      src = tmpSrc.FullName
      dst = tmpDst.FullName
      
      For Each at In tmpSrc.AutoTextEntries
        'Application.OrganizerCopy Source:=src, Destination:=dst, Name:=at.Name, Object:=wdOrganizerObjectAutoText
        Set rng = tmpSrc.AutoTextEntries(at.Name).Insert(Where:=Selection.Range, RichText:=True)
        tmpDst.BuildingBlockEntries.Add at.Name, wdTypeAutoText, "Import", rng
        rng.Delete
      Next at
      tmpDst.Save
      MsgBox "OK."
    
    End Sub
    

    * Run the code and you're done. The former Autotexts are now Building Blocks of the type "Autotext" in the category "Import".

    • Marked as answer by Max Meng Tuesday, July 19, 2011 2:23 AM
    Monday, July 11, 2011 12:33 PM
  • Thanks, Alexander, I'll try it!

    I noticed you remmed out something I had already tried:  I also found the "OrganizerCopy" command in VBA7 help and it did NOT work.  I had created a template that contained my autotext entries from Word2003, and created a new document using that template.  So the autotext is in the ".attachedTemplate."    and I want to copy it to the  "NormalTemplate."

    I used

     

     For Each atEntry In ActiveDocument.AttachedTemplate.AutoTextEntries
          Application.OrganizerCopy _
            Source:=ActiveDocument.AttachedTemplate.FullName, _
            Destination:=NormalTemplate.FullName, Name:=atEntry.Name, _
            Object:=wdOrganizerObjectAutoText
        Next
    


    This did not throw an error but did NOTHING.   Perhaps the  wdOrganizerObjectAutoText  is no longer valid and VB help has not been updated?  If so, I'm mad, since I lost an hour messing with this!

    I'll try your idea and let you know.

     


    Plagoon2
    Monday, July 11, 2011 10:00 PM
  • Thanks, Alexander, it worked fairly well!

    I needed to change

    ThisDocument"

    to

    ActiveDocument

     

    but otherwise went as planned, thanks a bunch!

    NOTE that these are stored in  <Normal.dotm>  NOT in <Building Blocks.dotx> .

    I wonder if there is a repository for autotext items, e.g. like Ultraedit has a repository for syntax highlighting.

    I have some interesting sets, e.g.

            &bull •  &cent ¢   &clubs ♣    &copy ©  ...    various bullets, etc.

     

    ALSO, the misleading   Office.com  article   and  VB7 help  should be updated, I wonder how I can request that? (I just joined MSDN last week)

    Cheers! :) 



     


    Plagoon2
    Monday, July 11, 2011 10:47 PM
  • Oops, spoke too soon -- it appeared to import them correctly, but much of the formatting is off.

    Mostly an issue for font size:  e.g. 18 point rather than 12 point.

    I think I can fix this laboriously / manually every time it comes up.

     

    Thanks again  :) 


    Plagoon2
    Monday, July 11, 2011 11:45 PM
  • This did not throw an error but did NOTHING.   Perhaps the  wdOrganizerObjectAutoText  is no longer valid and VB help has not been updated?  If so, I'm mad, since I lost an hour messing with this!

    Yes, that was my experience too. It was my first try and it didn't work. So I had to find something else, but I left it commented out in the code to show what the following does.

    Regarding the font size: Maybe you used an modified style sheet with different font size. The insert command inserts the found Autotexts into the document and then grabs them again to store them as Building Blocks in the normal.dotm. You could use the Building Blocks.dotm, but this requires some more lines.

    You could rem the Delete command to see what's wrong with the formating.

     

    Tuesday, July 12, 2011 7:41 AM
  • Thanks for the suggestion, but since most of my autotext is really text, I just changed the code to insert as text (not autotext) and eliminated the probelm.  I was forced to do those that require formatting manually.

     

    Thanks for your help!  :)  Plagoon


    Plagoon2
    Friday, July 15, 2011 3:09 AM
  • Hi Plagoon,

    Please remember to click “Mark As Answer” on the post that helps you, this would benefit for the other community when they read this thread. Thanks for your understanding.


    Sincerely,

    Max Meng
    Forum Support


    Come back and mark the replies as answers if they help and unmark them if they provide no help.
    Tuesday, July 19, 2011 2:25 AM
  • Oops, spoke too soon -- it appeared to import them correctly, but much of the formatting is off.

    Mostly an issue for font size:  e.g. 18 point rather than 12 point.

    I think I can fix this laboriously / manually every time it comes up.

     

    Thanks again  :) 


    Plagoon2

       

    Note that unless you explicitly saved a font size with the AutoText entry, when inserting the entry it will adjust to the formatting at the insertion point (in the target file).

    Stefan Blom, Microsoft Word MVP

    Tuesday, July 19, 2011 6:47 AM