Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 8
Default Remove Excel password

I have about 500 Excel files which are password protected with the same
password. I do know the password. Is there a utility or can a sciprt be
written to remove all passwords on all files in the same folder ? I am
trying to avoid opening them all and changing the setting manually.

Thanks
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Remove Excel password

You could try this...

Option Explicit
Sub testme01()

Dim myNames() As String
Dim fCtr As Long
Dim myFile As String
Dim myPath As String
Dim TempWkbk As Workbook
Dim DestCell As Range
Dim myPWD As String

myPWD = "hi"

'change the folder here
myPath = "C:\my documents\excel\test"
If myPath = "" Then Exit Sub
If Right(myPath, 1) < "\" Then
myPath = myPath & "\"
End If

myFile = ""
On Error Resume Next
myFile = Dir(myPath & "*.xls")
On Error GoTo 0
If myFile = "" Then
MsgBox "no files found"
Exit Sub
End If

Set DestCell = Workbooks.Add(1).Worksheets(1).Range("a1")
DestCell.Resize(1, 2).Value _
= Array("Workbook Name", "Ok?")

Application.ScreenUpdating = False

'get the list of files
fCtr = 0
Do While myFile < ""
fCtr = fCtr + 1
ReDim Preserve myNames(1 To fCtr)
myNames(fCtr) = myFile
myFile = Dir()
Loop

If fCtr 0 Then
For fCtr = LBound(myNames) To UBound(myNames)
If LCase(myNames(fCtr)) = LCase(ThisWorkbook.Name) Then
'do nothing, skip this file
Else
Application.StatusBar _
= "Processing: " & myNames(fCtr) & " at: " & Now

Set DestCell = DestCell.Offset(1, 0)
DestCell.Value = myNames(fCtr)

Set TempWkbk = Nothing
On Error Resume Next
Set TempWkbk = Workbooks.Open(Filename:=myPath _
& myNames(fCtr), Password:=myPWD)
On Error GoTo 0

If TempWkbk Is Nothing Then
DestCell.Offset(0, 1).Value = "Could not open"
Else
With TempWkbk
.Password = ""
.Save
.Close savechanges:=False
End With
DestCell.Offset(0, 1).Value = "Password removed"
End If
End If
Next fCtr
End If

DestCell.Parent.UsedRange.Columns.AutoFit

With Application
.ScreenUpdating = True
.StatusBar = False
End With

End Sub



Dave Mc wrote:

I have about 500 Excel files which are password protected with the same
password. I do know the password. Is there a utility or can a sciprt be
written to remove all passwords on all files in the same folder ? I am
trying to avoid opening them all and changing the setting manually.

Thanks


--

Dave Peterson
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
changing password in Excel workbook Val Excel Worksheet Functions 6 November 12th 06 08:22 AM
Excel (Office 2007 B2TR) -- Password Protecting A Sheet -- Character Limit ? Office2007B2TR_Tester_91311 Excel Discussion (Misc queries) 2 October 12th 06 07:08 PM
Need excel password cracker. Groenie Excel Worksheet Functions 1 February 2nd 06 04:26 PM
how to automate opening a password protected excel file? e.g. a .xls that has a password set in the security tab. Daniel Excel Worksheet Functions 0 June 23rd 05 11:56 PM
password issues in Excel 2002 Stephen Larivee Excel Discussion (Misc queries) 7 February 18th 05 10:58 PM


All times are GMT +1. The time now is 01:01 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"