|
|
|||||||
Hi guys, It seems to be possible to open a password protected Excel file but somehow I'm not getting the correct results. Excel opens the workbook just fine but it keeps asking for a password. It should be auto entered by the open line. See: this link, this link and this link. Am I missing something? Is this not possible in kix? Am I just dumb and blind when it comes to COM stuff? BTW: this is about the "Open file" password not the "Edit file" password. Code: Break on $objExcel = CreateObject("Excel.Application") $objWorkBook = $objExcel.Workbooks.open("d:\somefolder\book1.xlsx",Password:="Test123") $objexcel.Visible = True |
||||||||
|
|
|||||||
Nevermind. Fixed it. The password is the fifth parameter and not the second as shown in my first links. See: link. Code: Break on $rc = SetOption("WrapatEOL", "On") $objExcel = CreateObject("Excel.Application") ? @ERROR ? @SERROR $objWorkBook = $objExcel.Workbooks.open("D:\some folder\book1.xlsx",,,,"Test123") ? @ERROR ? @SERROR Sleep 5 $objexcel.Visible = True works fine. |
||||||||
|
|
|||||||
And (off course) the Password:= part messes things up a bit |
||||||||
|
|
|||||||
Haven't really needed but nice to know how if I ever do. Thanks for posting |