Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
macro to password protect exel file
Hi,
I need to password protect hundreds of exel files with the same password, but my boss wants them done one by one (as opposed to a zip file). The files are in different directories and have different names. Can I create a macro that will do the following once I have the file open? Go to Save As Go to Tools Select General Options Enter password to protect (i.e. 1234) click OK Retype password Click OK Save I have been doing this for the past hour one file at a time and my fingers are really tired now. Any help is GREATLY appreciated. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
macro to password protect exel file
Look at help on the Workbook.SaveAs command. Password is one of the
arguments. Sub PasswordFiles() Dim sFname as String, sPath as String sPath = "C:\My Folder\" sFname = Dir(sPath & "*.xls") do While sFname < "" Workbooks.Open sPath & sFname Application.DisplayAlerts = False ActiveWorkbook.Saves FileName:=ActiveWorkbook.fullname, _ FileFormat:=xlWorkbookNormal, Password:="1234" Application.DisplayAlerts = True ActiveWorkbook.Close SaveChanges:=False sFname = Dir() Loop End Sub -- Regards, Tom Ogilvy "anelh6" wrote in message ... Hi, I need to password protect hundreds of exel files with the same password, but my boss wants them done one by one (as opposed to a zip file). The files are in different directories and have different names. Can I create a macro that will do the following once I have the file open? Go to Save As Go to Tools Select General Options Enter password to protect (i.e. 1234) click OK Retype password Click OK Save I have been doing this for the past hour one file at a time and my fingers are really tired now. Any help is GREATLY appreciated. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Can a Macro on exel be set with a password? | Excel Worksheet Functions | |||
Password Protect CSV File | Excel Discussion (Misc queries) | |||
how do i password protect an .xls file? how do i unlock it for automation. e.g. want to unlock and access a .xls from another .xls macro. | Excel Worksheet Functions | |||
password protect .csv file | Excel Discussion (Misc queries) | |||
Password protect folders in Exel | Excel Discussion (Misc queries) |