LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default Automate new Word file and insert autotext


I'm trying to use Excel to automate the creation of a new Word file
using a premade Word template. It makes the new Word file, but breaks
on the last line where I try to insert my autotext. Please review and
help me fix what I'm doing wrong. Also, if it matters, I also intend to
mailmerge this Word doc to the active Excel file. The autotext
definitely exists, so I must be calling it incorrectly. Thanks for
helping!


Dim objWord As Word.Application

Set objWord = CreateObject("Word.Application")
If Err Then
Set objWord = New Word.Application
End If

objWord.Visible = True
objWord.Activate

objWord.Documents.Add Template:="c:\templates\template.dot",
NewTemplate:=False, DocumentType:=0

objWord.ActiveDocument.AttachedTemplate.AutoTextEn tries("FORMS").Insert
Whe=Selection.Range, RichText:=True




--
leaftye
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Editing embedded Word file in Excel JUMPS to top Steve Brewster Excel Discussion (Misc queries) 0 September 12th 06 04:12 PM
when i insert word art in excel sheet excel file closes automatica marwin Excel Discussion (Misc queries) 1 April 10th 06 03:29 PM
problem with insert Excel file in another Excel file Rao Ratan Singh New Users to Excel 1 January 11th 06 08:11 PM
Insert & link a graphic file in Excel 2003 -- updatable pictures! ODI Excel Discussion (Misc queries) 7 November 14th 05 02:36 PM
Can I insert a word document into a new excel file ? Robyn78 Excel Discussion (Misc queries) 2 August 2nd 05 08:43 PM


All times are GMT +1. The time now is 10:14 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"