View Single Post
  #5 (permalink)  
Old November 21st, 2003, 09:17 AM
pgtips pgtips is offline
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,212
Thanks: 0
Thanked 1 Time in 1 Post
Default

There's also a typo in line 2:
Set objExcel = WSript.CreateObject("Excel.Application")
it should be WScript not WScipt

Sorry about that

I just had a thought - Excel offers different levels of protection. I assumed you meant the worksheet had password protection (Tools > Protection > Protect Sheet), but maybe you meant that it has a password specified in the SaveAs dialog when the file was first created? If this is the case you can only remove the password by saving it as a new file name, like this (hope for no typos :))
Code:
Option Explicit
Dim objExcel
Set objExcel = WScript.CreateObject("Excel.Application")
objExcel.Workbooks.Open "<<name and path>>",,,,"<<password>>"
objExcel.Workbooks(1).SaveAs "<<new name>>",,""
objExcel.Workbooks.Close
Set objExcel = Nothing
rgds
Phil
Reply With Quote