I have 106 xls files. All of them are password-protected in the following format:
$ & *first four characters of file name* & 010808
For example, a files named Matthew.xls would have the password $Matt010808.
I have a macro that password-protected batches of files by this format but now I need one that unpassword-protects them.
Can anybody help?
Here is the macro that password-protects them:
Quote:
Sub SaveEncrypted()
'1. Select multiple .xls files
'2. Password protects them in the format: "$ + first four characters of file name + today's date" (e.g. $Matt100108)
'3. Encrypts and Saves them in Workbook95/5.0 format
'4. Stores the File Names and Passwords in a separate workbook.
Dim FilesToOpen
Dim filecounter As Integer
Dim wbName As String
Dim wbPass As String
Dim rowcounter As Integer
On Error GoTo ErrHandler
Application.ScreenUpdating = False
FilesToOpen = Application.GetOpenFilename _
(FileFilter:="Microsoft Excel Files (*.xls), *.xls", _
MultiSelect:=True, Title:="Files to Encrypt")
If TypeName(FilesToOpen) = "Boolean" Then
MsgBox "No Files were selected"
GoTo ExitHandler
End If
Application.DisplayAlerts = False
filecounter = 1
rowcounter = 2
While filecounter
The following code is what I have at this time to password protect an individual file when it is open.
When I run it it simply pops up a screen asking me to enter the password I want to protect the file with, I enter the file then click ok.
Code:
Sub Protect_sheets()
Dim wSheet As Worksheet
Dim Pwd As String
Pwd = InputBox("Enter your password to protect all worksheets", "Password Input")
For Each wSheet In Worksheets
wSheet.Protect Password:=Pwd
Next wSheet
End Sub
What I'm looking for is a a code that instead when run I want to 1st prompt me to select a directory and once selected have a 2nd prompt asking me to enter the password of my choice then lastly open each file within the chosen directory, protect it using the password just entered and saved. Can anyone assist?
I am trying to find a macro to create new password protected file everytime the value changes in column C. Then create an outlook e-mail to the e-mail address in column M with the new file attached. Is this even possible?
Very new to VB. Have managed to paste this code into a workbook:
Option Explicit
Private Sub Workbook_Open()
Worksheets("Sheet1").Activate
End Sub
Private Sub Workbook_SheetDeactivate(ByVal Sh As Object)
Dim ans
Dim sh2 As Worksheet
Application.EnableEvents = False
If ActiveSheet.Name <> "Sheet1" Then
Set sh2 = ActiveSheet
Sh.Activate
Application.ScreenUpdating = False
ans = Application.InputBox("Supply password")
If ans <> False Then
If ans = "password" Then
sh2.Activate
End If
End If
End If
Application.ScreenUpdating = True
Application.EnableEvents = True
End Sub
It works great, but would like to modify it so that I only need to enter the
password once to gain access to all worksheets, not each time I change
worksheets.
Much appreciated,
rob
I am using excel 2003 and need to be able to password protect several workbooks as well as giving a user the option to change the password.
Sheets within the workbooks have formulas protected to avoid user error and dont want them to be unpotected.
Is there a sinple way to achive this without the use of macros?
Many thanks in advance.
Hi,
I would like to password protect my workbook on activation can anyone help please, thanks Steve.
EXCEL - 2003
I have 2 macros that 1 will unprotect and 1 to protect the workbook with a unique password.
Also, in the same sheet, i have 2 macros that 1 will unprotect and 1 to protect multiple worksheets all with same paswords.
Problem: When i protect/unprotect the worksheet, it also updates/over-rides the password for the workgroup. Why?
Below is the code:
Workgroup:
Application.ScreenUpdating = False
ActiveWorkbook.Unprotect ("test")
Worksheets:
Application.ScreenUpdating = False
Dim sht As Worksheet
For Each sht In Sheets(Array("PG SP (wk1)", "PG SP (wk2)", "PG SP (wk3)", "PG SP (wk4)", "PG SP (wk5)", "PG SS (wk1)", "PG SS (wk2)", "PG SS (wk3)", "PG SS (wk4)", "PG SS (wk5)"))
sht.Protect Password:="Program"
Next sht
Am i doing something wrong??
new computer user aswell as excel
I find no way to password protect workbook. thanks