Jump to content

Difficulty with the method ... (vlax-invoke-method wb-collection "open" filepath)


edersonAmbrosio

Recommended Posts

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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 :shock:

Link to comment
Share on other sites

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 :shock:

 

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)

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...