いつもお世話になっております。
以下フォーラムの回答を参考にし10桁のランダムのパスワードの作成は実施できたのですが指定したExcelファイルに対して作成した10桁のランダムのパスワードを設定する方法がわからない状態です。
もしご存じの方がいらっしゃましたら教えていただきたいです。
宜しくお願い致します。
いつもお世話になっております。
以下フォーラムの回答を参考にし10桁のランダムのパスワードの作成は実施できたのですが指定したExcelファイルに対して作成した10桁のランダムのパスワードを設定する方法がわからない状態です。
もしご存じの方がいらっしゃましたら教えていただきたいです。
宜しくお願い致します。
Hi @vgmadtg
Sub ProtectWorkbook(password As String)
ThisWorkbook.Password = password
ThisWorkbook.Save
End Sub
In the output the generated password is dispayed.Once we enter the password the excel file will open
Output
Hope it helps!!
Hi @pravallikapaluri
Thank you!
Could you please send me the sample data you used?
The file you want to be Protected with password need to use in the use excel file.
- Sequence
- Assign: rnd = new Random() (Type: System.Random)
- Assign: password = new String(Enumerable.Repeat("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789", 10).Select(Function(s) s(rnd.Next(s.Length))).ToArray()) (Type: System.String)
- Excel Application Scope
- Path: "YourExcelFilePath.xlsx"
- Invoke VBA
- CodeFilePath: "C:\Path\To\ProtectWorkbook.vbs"
- EntryMethodName: "ProtectWorkbook"
- Parameters: password
Regards
@pravallikapaluri
thank you!
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.