1. David Vasconcelos
  2. PowerBuilder
  3. Thursday, 29 April 2021 20:26 PM UTC

I tried

iole_word.documents.open("filename", true, false, false,"passwordhere")

but it fails...

Environment

PB17r3, office 365 pro plus...

Accepted Answer
Mark Goldsmith Accepted Answer Pending Moderation
  1. Thursday, 29 April 2021 22:00 PM UTC
  2. PowerBuilder
  3. # Permalink

Hi David,

You do have the correct syntax (and the missing space between ," after the last false shouldn't matter). Are you getting an error message of some kind?

Can you share any of the other code leading up to this line (and a few lines that follow)? As well, have you tried removing the password from the document (and the last four parameters of the .Open call) to see whether it will open the document?


If it still doesn't open maybe you have something else going on in your code prior to this statement. I apologize if I'm stating obvious things you've already validated but, maybe it can't find the document, maybe the wrong password!?

Regards...Mark

Comment
  1. David Vasconcelos
  2. Friday, 30 April 2021 10:52 AM UTC
Hi Mark, all I get is the following



Message: PowerBuilder Runtime Error: 35 at Line: 59 in Object: w_sm08a_case_plan4 Event/Function: ue_worddoc_validations Text:

Error calling external object function open at line 59 in ue_worddoc_validations event of object w_sm08a_case_plan4.



Just the ole create and connection, is the line before it. Open does work if I only pass the file name but it prompts for the password.



iole_word = Create OleObject

li_RC = iole_word.ConnectToNewObject("word.application")

li_rc = iole_word.documents.open("filename", true, false, false, "passwordhere")
  1. Helpful
  1. David Vasconcelos
  2. Friday, 30 April 2021 11:18 AM UTC
Hi Mark, finally figured it out. There was a second password (for writing) that was needed. Once I added it then I was finally able to open the doc...
  1. Helpful
  1. Mark Goldsmith
  2. Friday, 30 April 2021 13:19 PM UTC
Great to hear David and thanks for the update.
  1. Helpful
There are no comments made yet.


There are replies in this question but you are not allowed to view the replies from this question.