open template as document

G

Guest

I want to use
Set objWord = GetObject("C:\MyMerge.doc", "Word.Document")
but want to create a word document based on a template. If my file is
"C\mymerge.dot" how do i get it to open as a document .doc based on the
template

thanks
 
J

Joe Black

judith said:
I want to use
Set objWord = GetObject("C:\MyMerge.doc", "Word.Document")
but want to create a word document based on a template. If my file is
"C\mymerge.dot" how do i get it to open as a document .doc based on the
template

thanks

Hi Judith

Dim objWord As Object
Dim objMergeDoc As Object

On Error Resume Next
Set objWord = GetObject(, "Word.Application")
If Err.Number <> 0 Then
Set objWord = CreateObject("Word.Application")
End If

Err.Clear

objWord.Visible = True
objWord.Activate

Set objMergeDoc = objWord.Documents.Add("C:\MyMerge.dot")

objMergeDoc.Bookmarks("TodayDate").Select
objWord.Selection.Text = Format(Date, "d mmmm yyyy")


Regards - Joe
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top