ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   save as macro/for password (https://www.excelbanter.com/excel-worksheet-functions/41639-save-macro-password.html)

Dedrie

save as macro/for password
 
I need to add the same password to 200 documents.

I recorded a macro:
ub Macro1()
'
' Macro1 Macro
' Macro recorded 8/22/2005 by Dedrie Smith
'
' Keyboard Shortcut: Ctrl+Shift+Q
'

ActiveWorkbook.SaveAs Filename:= _
"G:\Budget 2006\Individual Managers\TAnderson"_
FileFormat:=xlNormal, Password:="newone", WriteResPassword:="meonly" _
, ReadOnlyRecommended:=True, CreateBackup:=False
End Sub

Which works, except when I open the next file, it copies the macro over with
the previous file name and then tries to save over that file.

I'm sure there's a way to have the macro name the file based on it's current
name, or the cell reference (A2) which also contains the file name, but I
don't know how to write that code.

It also may be that there's an easier way to do this other than opening each
of the 200 files.

Any assistance/suggestions are appreciated!

Thanks!!


All times are GMT +1. The time now is 12:34 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com