PDA

View Full Version : new doc from template from excel



Ric
01-31-2018, 06:38 AM
Hello,

I'd like with Excel create a new doc in word from a template.


Dim appWD As Word.Application
Dim docWD As Word.Document

On Error Resume Next
Set appWD = GetObject(, "Word.application") 'gives error 429 if Word is not open
If Err = 429 Then
Set appWD = CreateObject("Word.application") 'creates a Word application
Err.Clear
End If
Documents.Add Template = "Macintosh HD/users/eric/Library/Group Containers/UBF8T346G9.Office/User Content.localized/Templates.localized/CONV_INTRA_2015.dotx", NewTemplate:=False, DocumentType:=wdNewBlankDocument, Visible:=True

The result is a new doc with the template normal.

Someone to help me please ?

macropod
01-31-2018, 10:12 PM
Try:

Dim appWD As New Word.Application
Dim docWD As Word.Document
Set docWD = appWD.Documents.Add(Template:="Macintosh HD/users/eric/Library/Group Containers/UBF8T346G9.Office/User Content.localized/Templates.localized/CONV_INTRA_2015.dotx", _
NewTemplate:=False, DocumentType:=wdNewBlankDocument, Visible:=True)

Ric
02-08-2018, 12:34 AM
Hi,

Thanks for your answer. That's don't works. I'll try to do by a different way.


Try:

Dim appWD As New Word.Application
Dim docWD As Word.Document
Set docWD = appWD.Documents.Add(Template:="Macintosh HD/users/eric/Library/Group Containers/UBF8T346G9.Office/User Content.localized/Templates.localized/CONV_INTRA_2015.dotx", _
NewTemplate:=False, DocumentType:=wdNewBlankDocument, Visible:=True)

macropod
02-08-2018, 04:48 AM
That's don't works. I'll try to do by a different way.
In that case I suggest you check your file path & name.