Reputation: 11
I'm trying to make a script that will remove the password protection for a excel (.xls) file but i keep getting the following error when I try to open my workbook:
"Unable to get the Open property of the Workbook class"
My code to open the file is:
sfPath = objArgs(0)
spassword = objArgs(1)
set objExcelFile = CreateObject("Excel.Application")
set objWorkbook = objExcelFile.Workbooks.Open(sfPath, spassword)
Any help would be much appreciated.
Upvotes: 0
Views: 5246
Reputation: 503
Did you read the docs.
You code is passing a string instead of a number specifing to update links or not. Password is the 5th parameter.
expression.Open(FileName, UpdateLinks, ReadOnly, Format, Password, WriteResPassword, IgnoreReadOnlyRecommended, Origin, Delimiter, Editable, Notify, Converter, AddToMru, Local, CorruptLoad, OpenConflictDocument)
Upvotes: 1