-
Solved: unprotect sections of word document with excel
Hi,
I have a program that pushes values from Excel to a Word template. Part of the word template has a protected section (section2) and I need to somehow disable the protection with the excel vba and once everything has been completed to put the password back on the section.
I've been trying to search for this, but I can only find how to protect the whole document.
-
[VBA]Sub Proccess_Word_Document()
Const strPassword As String = "password"
Dim wdApp As Word.Application
Dim wdDoc As Word.Document
Set wdApp = GetObject(, "Word.Application")
Set wdDoc = wdApp.Documents(1)
wdDoc.Unprotect strPassword
'Do actions
wdDoc.Protect Password:=strPassword, Type:=wdAllowOnlyReading
Set wdDoc = Nothing
Set wdApp = Nothing
End Sub[/VBA]
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules