0

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.

user3712526
  • 11
  • 1
  • 4
  • I've noticed that this error only appears when I add the password parameter to the Open property. Any thoughts as to why? – user3712526 Jun 11 '14 at 16:46

1 Answers1

1

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)
phd443322
  • 493
  • 3
  • 4