The problem is with the path used $restrictfile. I get your error if my path is wrong, make sure you use the full absolute path.(eg 'c:\\myfiles\\test.xls') Excel defaults to My Documents when it calls Open() vs the local directory your are executing your script from.