Open copy of Word template from Excel

AJW

New Member
Joined
Feb 2, 2003
Messages
21
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
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
Try declaring MyDoc as Word.Document and removing the .dot from the file path of your template.
 
Upvote 0
Hi Craig,

Thanks for the reply.

I've tried that combination and it didn't work.

Regards

AJW
 
Upvote 0
Sorry for that. I didn't try it out first with the password protection. I guess you should really usually use the Add method, rather than the Open method to create a new document based on a template. However (unfortunately) this method doesn't seem to have any password passing capability.
 
Upvote 0
Yeah, that's where I'm stuck.

Tried the Add method which works fine on an unprotected template but wont allow you to send the the password across.

I need to protect the templates from being tampered with so they remain in the standard corporate format. What people do with the copy they save is up to them.

Any other ideas?

Thanks

AJW
 
Upvote 0

Forum statistics

Threads
1,203,683
Messages
6,056,728
Members
444,887
Latest member
cvcc_wt

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top