![]() |
Auto assign password to existing files
I have a need to automate me assinging passwords to say 50 different excel
workbooks. These workbooks have a common format for the filename - it is DEPTxxx - where xxx is the actual department. I need a program to read the folder where these are stored, open, place a password on the document and save the file. Additionally the filename and associated password need to be recoreded - obviosly. The password would be great it if was auto-generated or retrieved from an existing sheet of names or something. Does this make sense? |
Auto assign password to existing files
If you don't ever know where the files are located, you could go into DOS and
create a text file: Dir /b /s DEPT*.xls C:\FileList.txt Then use this text file as your list of Deptxxx.xls files ... Open "C:\FileList.txt" for input as #1 For each file in filelist.txt Open Assign Password Save Close Next That might handle part of the problem anyhow. It doesn't look like the password gets recorded anyhwe ActiveWorkbook.Protect Structu=True, Windows:=False So you might be able to do a SEND KEYS command to type in each password. Let me know if any of this helps. "jay" wrote: I have a need to automate me assinging passwords to say 50 different excel workbooks. These workbooks have a common format for the filename - it is DEPTxxx - where xxx is the actual department. I need a program to read the folder where these are stored, open, place a password on the document and save the file. Additionally the filename and associated password need to be recoreded - obviosly. The password would be great it if was auto-generated or retrieved from an existing sheet of names or something. Does this make sense? |
Auto assign password to existing files
This works:
'You would generate a random password and replace "password" here strRandom = "password" Open the Deptxxx.xls Open "C:\pwdList.txt" For Append As #1 Print #1, Filename & Path & strRandom SendKeys "%TPW" & strRandom & "~" & strRandom & "~", True Close #1 Close & Save Deptxxx.xls "jay" wrote: I have a need to automate me assinging passwords to say 50 different excel workbooks. These workbooks have a common format for the filename - it is DEPTxxx - where xxx is the actual department. I need a program to read the folder where these are stored, open, place a password on the document and save the file. Additionally the filename and associated password need to be recoreded - obviosly. The password would be great it if was auto-generated or retrieved from an existing sheet of names or something. Does this make sense? |
Auto assign password to existing files
OK, I am a little "lost" and I know you probably think what the heck is guy
thinking - smile. I don't know alot of programming or anything. I was hopeing I could somehow download a list of names/object somewhere and put them in an excel worksheet that I could then use to pull all the passwords. Of course I would need to pick a password randomly from that list. I wasn't sure how this was automatec and how/if it tracked the password and filename it assigned to? If I have a number of xcel workbooks and I want to somehow feed those names into a worksheet for my "file password status" - good idea - maybe have a workbook that contains the filenames in one column, an assigned password column, a status indicator that it has been completed column and then another worksheet that contains the "source" of passwords. Then I would "copy" the code from one of you wizard's, slightly modify it to protect the innocent and then justify why working on this site is a good idea (to my boss). Thanks again for any help.... "Access101" wrote: This works: 'You would generate a random password and replace "password" here strRandom = "password" Open the Deptxxx.xls Open "C:\pwdList.txt" For Append As #1 Print #1, Filename & Path & strRandom SendKeys "%TPW" & strRandom & "~" & strRandom & "~", True Close #1 Close & Save Deptxxx.xls "jay" wrote: I have a need to automate me assinging passwords to say 50 different excel workbooks. These workbooks have a common format for the filename - it is DEPTxxx - where xxx is the actual department. I need a program to read the folder where these are stored, open, place a password on the document and save the file. Additionally the filename and associated password need to be recoreded - obviosly. The password would be great it if was auto-generated or retrieved from an existing sheet of names or something. Does this make sense? |
Auto assign password to existing files
"jay" wrote: OK, I am a little "lost" and I know you probably think what the heck is guy thinking - smile. I don't know alot of programming or anything. I was hopeing I could somehow download a list of names/object somewhere and put them in an excel worksheet that I could then use to pull all the passwords. Of course I would need to pick a password randomly from that list. I wasn't sure how this was automatec and how/if it tracked the password and filename it assigned to? If I have a number of xcel workbooks and I want to somehow feed those names into a worksheet for my "file password status" - good idea - maybe have a workbook that contains the filenames in one column, an assigned password column, a status indicator that it has been completed column and then another worksheet that contains the "source" of passwords. Then I would "copy" the code from one of you wizard's, slightly modify it to protect the innocent and then justify why working on this site is a good idea (to my boss). Thanks again for any help.... "Access101" wrote: This works: 'You would generate a random password and replace "password" here strRandom = "password" Open the Deptxxx.xls Open "C:\pwdList.txt" For Append As #1 Print #1, Filename & Path & strRandom SendKeys "%TPW" & strRandom & "~" & strRandom & "~", True Close #1 Close & Save Deptxxx.xls "jay" wrote: I have a need to automate me assinging passwords to say 50 different excel workbooks. These workbooks have a common format for the filename - it is DEPTxxx - where xxx is the actual department. I need a program to read the folder where these are stored, open, place a password on the document and save the file. Additionally the filename and associated password need to be recoreded - obviosly. The password would be great it if was auto-generated or retrieved from an existing sheet of names or something. Does this make sense? |
All times are GMT +1. The time now is 12:01 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com