Opening password protected excel file with a readonly pop up

Falua

New Member
Hi Guys,

When i double click on my excel macro-enabled file, there is a pop up which is generated which asks whether to open the excel file in a readonly mode or not. I should click on the 'No' option.

1525845216225.png

I tried to code the action by duplicating the MS Excel VBO- Open Workbook object and adding the parameter ReadOnly but getting handle error.
Can you please help with the code stage so that Blueprism automatically caters for the popup on startup?


1525845492962.png


Thanks,
Falua.
 

VJR

Well-Known Member
Hi Falua,

If you can show what the error is that would be great.
Also how does you diagram look like before reaching the 'Open Workbook'?
Since a file can be set as ReadOnly without a password too, so does your file have a password?
 

Falua

New Member
Hi VJR,

As a summary, I managed to make the coding part work for the readonly popup by adding "IgnoreReadOnlyRecommended:=True" to the Open workbook statement as follows:

1525863432058.png


In order to test that the VBO is working as expected, this is what i have tried:

1525863583991.png

Thanks,
Falua.
 

VJR

Well-Known Member
Hi VJR,

As a summary, I managed to make the coding part work for the readonly popup by adding "IgnoreReadOnlyRecommended:=True" to the Open workbook statement as follows:

View attachment 731


In order to test that the VBO is working as expected, this is what i have tried:

View attachment 732

Thanks,
Falua.
What you did is perfect and I was about to suggest you the same (IgnoreReadOnlyRecommended).
 

Falua

New Member
Thanks VJR,

My next issue is with the password.
Since my worksheet is protected, I have to unprotect the worksheet by:
1. clicking on the highlighted in blue option
2. Entering a specific password, then unhide some tabs in the excel file.


1525864755702.png


Do you have any idea on how to proceed?


Thanks,
Falua.
 

VJR

Well-Known Member
Hi Falua,

I guess you meant "Since my worksheet Workbook is protected".
Clicking the ribbon buttons would not be a recommended best practice when you can either use an inbuilt VBO action or create one.
For #1. Create a duplicate copy of the already existing 'Protect Workbook' action and name it as Unprotect Workbook.
Change its line of code as below-
wb.Unprotect(Password)

For #2. Create a duplicate copy of the already existing 'Hide Worksheet' action and name it as Unhide Worksheet.
Change its line of code as below-
ws.Visible = True

This should resolve both of your queries.
 

Falua

New Member
Hi VJR,

Thanks for the solution.

I am getting the error below while trying the solution: "The given key was not present in the dictionary."
Can you please help in debugging?

1525928676548.png


Thanks,
Falua.
 

VJR

Well-Known Member
Hi Falua,

The code I supplied you was as below without the parameters because the Unprotect method does not have any parameters.
wb.Unprotect(Password)
 

Falua

New Member
I have already pasted the code stage for the unprotect workbook.
please find below the stages which i am trying to do:

1525930078785.png
 

VJR

Well-Known Member
Hi Falua,

Can you show the populated values of these data items just before entering into the Unprotect Workbook.
Also the diagram is not showing the properties of the Unprotect workbook stage (double click and take a screenshot of the Inputs tab).
 

Falua

New Member
Hi again VJ,

These are dummy data that i have tried to populate in the data items. The workbook/filename exists on the local computer and works till i am trying to unprotect the workbook.

1525930866919.png

Input of the action Unprotect workbook :

1525931341395.png

Thanks,
Falua
 

Attachments

  • 1525930846705.png
    1525930846705.png
    31.5 KB · Views: 39

VJR

Well-Known Member
Hi Falua,

I'm easily able to get through the Unprotect Workbook stage without any issues with the above said steps.
After passing through the stage it successfully unprotects the workbook too.
Since there is no visibility on your side of the process its hard to tell what the issue is though I still think it is a parameter issue. Try other operations from any of the existing actions that are related to a "Workbook".

1525930086542.png

1525930557100.png


1525930223154.png
 

Falua

New Member
Thanks VJ,

My issue is resolved. The actual problem was more technical.
Since my 'Create instance' action and my 'Unprotect workbook' action were in separate objects, i got those internal errors.
The main thing is use all actions from same object when you interact with Excel. All the duplicates should be in the same object and it's working fine now ;)

Regards,
Falua
 

J_autobot23

New Member
Thanks for posting this question and the responses to help resolve the issue. I had a similar issue while trying to open password protected Excel files, only I just needed to read without getting the prompt. I used a modified version of the code Falua posted, only I excluded the "Password:=password" from the code block. Worked like a charm!
 

RPA_1

Member
There is a timeout error at Open WB stage only because of the password pop up. How to resolve that?
I only need to open a password protected Workbook.
 

J_autobot23

New Member
There is a timeout error at Open WB stage only because of the password pop up. How to resolve that?
I only need to open a password protected Workbook.

I will try to help with your issue. Please post a screenshot of the error you are seeing along with the code used in your code stage.
 
Top