Thankyou all so far for your help. The Export routine worked so well that now I need to work on an import. The source document contains a two column table. The first column is the name for the Autotext entry and the second is the value. I can import simple autotext entries using the script I have written here. The issue is like the import routine, the formating and images are lost. It is also limited to 255 characters. Any ideas ? Sub importAutotextEntries() ' Check to see if a table exists in the Active Document If ActiveDocument.Tables.Count = 0 Then MsgBox "No tables!" Exit Sub End If For i = 1 To ActiveDocument.Tables(1).Rows.Count 'first cell is the name for the new Autotext entry - Minus the Paragraph mark newname = ActiveDocument.Tables(1).Rows(i).Cells(1) namelength = Len(newname) namelength = namelength - 2 finalname = Left(newname, namelength) NormalTemplate.AutotextEntries.Add Name:=finalname, Range:=Selection.Range 'Second cell is the value for the new Autotext entry - Minus the Paragraph mark newvalue = ActiveDocument.Tables(1).Rows(i).Cells(2) valuelength = Len(newvalue) valuelength = valuelength - 2 finalvalue = Left(newvalue, valuelength) NormalTemplate.AutotextEntries(finalname).Value = finalvalue Next i End Sub -- Regards, Michael Jenkin MCP MVP SBS Australia www.mickyj.com
There seems to be no "value" parameter to add and the insert setting seems to be the only way to use richtext. Any ideas ? Michael Jenkin [SBS-MVP] wrote: > Thankyou all so far for your help. The Export routine worked so well > that now I need to work on an import. The source document contains a two > column table. The first column is the name for the Autotext entry and > the second is the value. > > I can import simple autotext entries using the script I have written > here. The issue is like the import routine, the formating and images are > lost. It is also limited to 255 characters. > > Any ideas ? > > > > > Sub importAutotextEntries() > > ' Check to see if a table exists in the Active Document > If ActiveDocument.Tables.Count = 0 Then > MsgBox "No tables!" > Exit Sub > End If > > For i = 1 To ActiveDocument.Tables(1).Rows.Count > > 'first cell is the name for the new Autotext entry - Minus the > Paragraph mark > newname = ActiveDocument.Tables(1).Rows(i).Cells(1) > namelength = Len(newname) > namelength = namelength - 2 > finalname = Left(newname, namelength) > NormalTemplate.AutotextEntries.Add Name:=finalname, > Range:=Selection.Range > > 'Second cell is the value for the new Autotext entry - Minus the > Paragraph mark > newvalue = ActiveDocument.Tables(1).Rows(i).Cells(2) > valuelength = Len(newvalue) > valuelength = valuelength - 2 > finalvalue = Left(newvalue, valuelength) > NormalTemplate.AutotextEntries(finalname).Value = finalvalue > > Next i > > End Sub > -- Regards, Michael Jenkin MCP MVP SBS Australia www.mickyj.com