I needed to write a script to remove passwords from Excel files today (I did know, the password, this wasn’t a cracking exercise).
The function is pretty self explanatory. it takes two arguments, and removes the password.
Filenamewithpath = “D:\VBscripts\test.xlsx”
Password = “6tg4HHE”
Set objExcel = CreateObject(“Excel.Application”)
objExcel.Visible = FALSE
objExcel.DisplayAlerts = FALSE
Set objWorkbook = objExcel.Workbooks.Open(Filenamewithpath„„Password)
objWorkbook.Password = “”
set objExcel = nothing
set objWorkbook = nothing