I have an Excel add-in which I use to do a large amount of data analysis, and then transfer the data to tables in a Word template. I would now like to insert some AutoText saved in the template before populating the tables, but I can't find the syntax to do this. I keep getting error code 450 - Wrong number of arguments or invalid property set.
Here's the code I'm using:
VB Code:
Dim WordApp As Word.Application Set WordApp = CreateObject("word.application") WordApp.Visible = True With WordApp Documents.Add Template:= _ "C:\Documents and Settings\all users\Templates\rxtemptest.dot" _ , NewTemplate:=False, DocumentType:=0 .Selection.Goto what:=wdGoToBookmark, Name:="PlaceMark" .ActiveDocument.AttachedTemplate.AutoTextEntries("Temp1").Insert Where:=Selection.Range, RichText:=True End With Set WordApp = Nothing
Can someone point me in the right direction? If it is not possible to use Excel to insert AutoText, can someone tell me how to call a procedure or macro saved in the Word template that will insert the AutoText?
Thanks, Lee


Reply With Quote