Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #9  
Old 03-08-2012, 12:07 AM
macropod's Avatar
macropod macropod is offline Removing password protection Windows 7 64bit Removing password protection Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,526
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Hi,

Your code's not right. It should be:
Code:
Sub UnprotectDocuments()
Application.ScreenUpdating = False
Dim strFolder As String, strPwd As String, strFile As String, wdDoc As Document, TrkStatus As Boolean
TrkStatus = Options.WarnBeforeSavingPrintingSendingMarkup
Options.WarnBeforeSavingPrintingSendingMarkup = False
strPwd = InputBox("What is the password?", "File Password")
If strPwd = "" Then Exit Sub
strFolder = GetFolder
If strFolder = "" Then Exit Sub
strFile = Dir(strFolder & "\*.doc", vbNormal)
While strFile <> ""
  Set wdDoc = Documents.Open(FileName:=strFolder & "\" & strFile, AddToRecentFiles:=False, _
    Visible:=False, PasswordDocument:=strPwd, WritePasswordDocument:=strPwd)
  With wdDoc
    '.ReadOnlyRecommended = False
    .Password = vbNullString
    .WritePassword = vbNullString
    .Close SaveChanges:=True
  End With
  strFile = Dir()
Wend
Set wdDoc = Nothing
Options.WarnBeforeSavingPrintingSendingMarkup = TrkStatus
Application.ScreenUpdating = True
End Sub
 
Function GetFolder() As String
Dim oFolder As Object
GetFolder = ""
Set oFolder = CreateObject("Shell.Application").BrowseForFolder(0, "Choose a folder", 0)
If (Not oFolder Is Nothing) Then GetFolder = oFolder.Items.Item.Path
Set oFolder = Nothing
End Function
Prior to editing, your reply also said 'the files are still being saved showing markups'. That's correct - the modified code doesn't change the document content in any way. In any event, whether you see the markup or final views is simply determined by choosing the appropriate options on the review tab. Nothing done during the above process can control how a document with tracked changes will be viewed later.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
 

Tags
password, protection, remove



Similar Threads
Thread Thread Starter Forum Replies Last Post
Removing password protection Did an auto-update remove password protection? namedujour Excel 0 11-22-2011 07:40 AM
Password Protection Problem todobfl Excel 4 07-26-2011 06:40 PM
Removing password protection Password Protection JimP Visio 2 03-24-2011 04:23 AM
Help reg Protection of cell. aligahk06 Excel 1 09-02-2009 05:45 PM
Visio - password protection icap5183 Visio 0 07-24-2009 06:00 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 11:02 PM.


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