Michael Jenkin [SBS-MVP]
2005-12-06 23:08:43 UTC
Hello,
I have a client with hundreds of custom autotext entires and they need
them exported to a word file table.
I have written code to do this and it works well. The only problem is
any formatting and images stored in the Autotext are lost.
Here is the code. Any ideas ? Being a novice at VBA, I would suggest the
issue is with Typetext or maybe the way I addressed the selection.
Thanks
Sub ExportAutotextEntries()
Documents.Add
ActiveDocument.Tables.Add Range:=Selection.Range, NumRows:=(2),_
NumColumns:=2,DefaultTableBehavior:=wdWord9TableBehavior,_
AutoFitBehavior:=wdAutoFitFixed
For Each i In ActiveDocument.AttachedTemplate.AutoTextEntries
Selection.TypeText i.Name
Selection.MoveRight Unit:=wdCell
Selection.TypeText i.Value
Selection.MoveRight Unit:=wdCell
Next i
MsgBox "Done"
End Sub
I have a client with hundreds of custom autotext entires and they need
them exported to a word file table.
I have written code to do this and it works well. The only problem is
any formatting and images stored in the Autotext are lost.
Here is the code. Any ideas ? Being a novice at VBA, I would suggest the
issue is with Typetext or maybe the way I addressed the selection.
Thanks
Sub ExportAutotextEntries()
Documents.Add
ActiveDocument.Tables.Add Range:=Selection.Range, NumRows:=(2),_
NumColumns:=2,DefaultTableBehavior:=wdWord9TableBehavior,_
AutoFitBehavior:=wdAutoFitFixed
For Each i In ActiveDocument.AttachedTemplate.AutoTextEntries
Selection.TypeText i.Name
Selection.MoveRight Unit:=wdCell
Selection.TypeText i.Value
Selection.MoveRight Unit:=wdCell
Next i
MsgBox "Done"
End Sub
--
Regards,
Michael Jenkin
MCP MVP SBS
Australia
www.mickyj.com
Regards,
Michael Jenkin
MCP MVP SBS
Australia
www.mickyj.com