edersonAmbrosio Posted July 21, 2015 Share Posted July 21, 2015 Hello! I'm having trouble reading a excel file password protected. The method "open" is documented as being able to use the parameter "password", but I did not get success yet. Someone help? Below is an excerpt from my code: (excel-app setq (vlax-create-object "Excel.Application") wb-collection (vlax excel-get-app "workbooks") folder (vlax-invoke-method wb-collection "open" filepathExcel ??? ???) ... The ??? would be read-only and password parameters ... grateful, Ederson Quote Link to comment Share on other sites More sharing options...
Commandobill Posted July 21, 2015 Share Posted July 21, 2015 Did you try using the open method, then use the unprotect method? Quote Link to comment Share on other sites More sharing options...
edersonAmbrosio Posted July 21, 2015 Author Share Posted July 21, 2015 Commadobill, thank you! I found this method. Using the consultation of the supported methods, getting only those below. The excel file is encrypted. They are not the spreadsheets that are protected, but the whole folder. # _$ (vlax-dump-object wb-collection t) ; Workbooks: nil ; Property values: ; Application (RO) = # ; Count (RO) = 0 ; Creator (RO) = 1480803660 ; Item (RO) = ...Indexed contents not shown... ; Parent (RO) = # ; _Default (RO) = ...Indexed contents not shown... ; _NewEnum (RO) = # ; Methods supported: ; Add (1) ; CanCheckOut (1) ; CheckOut (1) ; Close () ; Open (15) ; OpenDatabase (5) ; OpenText (18) ; OpenXML (3) T Quote Link to comment Share on other sites More sharing options...
edersonAmbrosio Posted July 21, 2015 Author Share Posted July 21, 2015 Prezados dear I managed after several trial and error. Please do not ask me what are those numbers 1 before the parameter "password". It seems to me that refer to "save as", "read-only", etc. For now, what interests us is the line below. (I did not find it documented anywhere) (vlax-invoke-method wb-collection "open" filepathExcel 1 1 1 (vlax-make-variant "password here")) Sincerely; Ederson Quote Link to comment Share on other sites More sharing options...
SLW210 Posted July 22, 2015 Share Posted July 22, 2015 Please read the Code Posting Guidelines and edit your post to include the Code in Code Tags. [NOPARSE] Your Code Here [/NOPARSE] Your Code Here Quote Link to comment Share on other sites More sharing options...
Commandobill Posted July 22, 2015 Share Posted July 22, 2015 Prezados dear I managed after several trial and error. Please do not ask me what are those numbers 1 before the parameter "password". It seems to me that refer to "save as", "read-only", etc. For now, what interests us is the line below. (I did not find it documented anywhere) (vlax-invoke-method wb-collection "open" filepathExcel 1 1 1 (vlax-make-variant "password here")) Sincerely; Ederson So you're saying this works? The documentation would be in VBA, which is this: expression .Open(FileName, UpdateLinks, ReadOnly, Format, Password, WriteResPassword, IgnoreReadOnlyRecommended, Origin, Delimiter, Editable, Notify, Converter, AddToMru, Local, CorruptLoad) Quote Link to comment Share on other sites More sharing options...
Commandobill Posted July 22, 2015 Share Posted July 22, 2015 Prezados (vlax-make-variant "password here")) What made you think to make it a variant? Quote Link to comment Share on other sites More sharing options...
edersonAmbrosio Posted July 22, 2015 Author Share Posted July 22, 2015 The method "open" cites that the password string must be converted to variant Signature object.Open Name[, ReadOnly][, Password] Object Documents, Document The objects this method applies to. Name String The full path and file name, or a valid URL address, of the drawing file to open. If the drawing is in the folder specified by the SupportPath property, then the path is not needed and the file name is sufficient. ReadOnly Variant; input-only; optional; Documents collection only Default setting: FALSE TRUE: Opens the drawing as a read-only drawing. FALSE: Opens the drawing as a read-write drawing. Password Variant; optional Password to open an encrypted drawing. Quote Link to comment Share on other sites More sharing options...
Commandobill Posted July 22, 2015 Share Posted July 22, 2015 Nice, Good work! Quote Link to comment Share on other sites More sharing options...
edersonAmbrosio Posted July 22, 2015 Author Share Posted July 22, 2015 Thank you too. I have a spreadsheet in Excel (already validated and reliable) with engneharia calculations and I needed to use it, while preserving access to content and formulas. Sorry my bad English. I am Brazilian. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.