View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Lee Lee is offline
external usenet poster
 
Posts: 33
Default Controlling Word template from Excel

I have an Excel add-in from which I can open a Word
template and insert info from the Excel workbook. I am
trying to insert AutoText that is saved in the template,
but I can't find the right syntax. This is what I have
written:

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
WordApp.Selection.Goto what:=wdGoToBookmark,
Name:="PlaceMark"
WordApp.Selection.Insert("temp1").InsertAutoText
Whe=Selection.Range, _
RichText:=True
End With

What am I doing wrong?