Hi All,
I've got a password protected Word template that I'm launching from Excel but am having a problem with it.
This is the code I've cobbled together that works to open the template:
Sub Open_MSWord_CV2()
On Error GoTo ErrorHandler
Dim wdApp As Word.Application
Dim MyDoc As Word.Template '.Document
Set wdApp = New Word.Application
With wdApp
.Visible = True
.WindowState = wdWindowStateMaximize
End With
Set MyDoc = wdApp.Documents.Open("C:\Program Files\pf.com\pf TEMPLATES\CONTRACT VARIATION.dot", passwordtemplate:="xxxxxxxxxyz")
Set wdApp = Nothing
Set MyDoc = Nothing
Exit Sub
ErrorHandler:
Set wdApp = Nothing
Set MyDoc = Nothing
End Sub
My problem is that it opens the ACTUAL TEMPLATE and not a copy of the template.
Does anyone know how to open a copy from a password protected template?
Thanks in advance.
AJW
I've got a password protected Word template that I'm launching from Excel but am having a problem with it.
This is the code I've cobbled together that works to open the template:
Sub Open_MSWord_CV2()
On Error GoTo ErrorHandler
Dim wdApp As Word.Application
Dim MyDoc As Word.Template '.Document
Set wdApp = New Word.Application
With wdApp
.Visible = True
.WindowState = wdWindowStateMaximize
End With
Set MyDoc = wdApp.Documents.Open("C:\Program Files\pf.com\pf TEMPLATES\CONTRACT VARIATION.dot", passwordtemplate:="xxxxxxxxxyz")
Set wdApp = Nothing
Set MyDoc = Nothing
Exit Sub
ErrorHandler:
Set wdApp = Nothing
Set MyDoc = Nothing
End Sub
My problem is that it opens the ACTUAL TEMPLATE and not a copy of the template.
Does anyone know how to open a copy from a password protected template?
Thanks in advance.
AJW