Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 12-07-2014, 10:41 PM
gmayor's Avatar
gmayor gmayor is offline Macro to Unprotect password protected document Windows 7 64bit Macro to Unprotect password protected document Office 2010 32bit
Expert
 
Join Date: Aug 2014
Posts: 4,142
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

Apart from the >> which should not be present, it works fine

Code:
Sub AddRow()
Const strPassWord As String = "password1"
    If ActiveDocument.ProtectionType <> wdNoProtection Then
        ActiveDocument.Unprotect Password:=strPassWord
    End If
    
    ActiveDocument.Tables(1).Rows.Add
    
    'If ActiveDocument.ProtectionType = wdNoProtection Then
        ActiveDocument.Protect _
                Type:=wdAllowOnlyFormFields, NoReset:=True, Password:=strPassWord
    'End If
End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote
 

Tags
macro, unprotect, word 2013

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Password protected file no longer offers password dialog on Open htaylor Word 0 10-15-2013 12:35 PM
How to open a password-protected word document? navalava Word 1 07-01-2012 12:15 PM
Macro to Unprotect password protected document Hyperlinks to password protected webpage john_ Outlook 2 07-28-2011 01:43 AM
Macro to Unprotect password protected document Oops password protected word !!! mistermouse Word 5 02-16-2011 01:56 PM
Password Protected Files gurp99 Word 0 08-17-2010 03:30 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 10:16 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft