View Single Post
  #14   Report Post  
Posted to microsoft.public.word.docmanagement
Red Mage Red Mage is offline
external usenet poster
 
Posts: 1
Default How to unlock the project if it is locked

Please help me....

Hello to all,Strange problem no idea....

I locked MySample template Project using
Tools - Template Project Properties - Protection tab -under Lock project
group i checked the checkbox (Lock for viewing) and also the password
"mypassword" in the password fields.This way i protected the document.

Now MySample template is protected,but i need to delete a module from this
template and i have to copy a module from other template using VBA. Im able
to delete the module but im not able to copy the module....

If the MySample template is not protected with Password the following code
works....othewise it fails

Sub MacroCopy

Dim MacroName, fromfile, tofile As String
MacroName = "TestMacro"

fromfile = "C:\MacroCopy.dot"
tofile = "C:\MySample.dot"
Documents.Open FileName:=tofile, Visible:=True
Documents(tofile).Activate

'Remove the existing Module from the template
On Error Resume Next
Application.OrganizerDelete Source:=tofile, Name:=MacroName, _
Object:=wdOrganizerObjectProjectItems
'Copy the macro to the template
Application.OrganizerCopy Source:=fromfile, Destination:=tofile _
, Name:="InspectionInfo", Object:=wdOrganizerObjectProjectItems
Documents.Save NoPrompt:=True, OriginalFormat:=wdOriginalDocumentFormat

ActiveDocument.ActiveWindow.Close

End Sub

what i have to do in the code so it can copy the module,eventhough it id
protected for viewing...

Thanks in Advance...