cancel
Showing results for 
Search instead for 
Did you mean: 

The given key was not present in the dictionary.

KumariYadav1
Level 5
Hi, Can anyone please try to help me with this error
During an excel operation I am getting the following error:
"Exception : Error while exporting to PDF. Details: The given key was not present in the dictionary."
Following are the steps which I am doing in BP:
Create instance->open workbook-> show->export worksheet to pdf->End
If I am trying to apply filter then also I am getting this same error. 
Thanks

------------------------------
Kumari Yadav
------------------------------
8 REPLIES 8

mkumar407
Level 7
Hi Kumari,

Generally 'The given key was not present in the dictionary' implies the VBO has no 'awareness' of the Excel file. The VBO keeps track of the instances and files it is using, and each time you perform an action it checks in its 'dictionary' to see it is 'knows' which instance/file to work on.
Refer link

------------------------------
Manish Kumar
------------------------------

EmersonF
MVP
Try to check if the handle was properly created, also check if the other actions are part of the same object

------------------------------
Emerson Ferreira
Sr Business Analyst
Avanade Brasil
+55 (081) 98886-9544
If my answer helped you? Mark as useful!
------------------------------
Sr Cons at Avanade Brazil

HI,

We have done in the object where workbook has opened, the supplied handle number and workbook name is generated by vbo excel actions. still, we are receiving the same error . coul you please tell us how to resolvevthis error.
29783.png

------------------------------
krishnaveni jaladi
Automation Specialist II
s&p global market intelligence
Asia/Kolkata
------------------------------

Double check that you are not using more than one version of the Excel VBO. If you have an 'extended' version of the VBO as well as the original, then you can get that error if you mix them up incorrectly. As Manish says, the error means that the VBO has no knowledge of the Excel instance, so it could be that you have one VBO that launched Excel and another VBO that is not attached.

------------------------------
John Carter
Professional Services
Blue Prism
------------------------------

JeevanR
Level 5
Hi Kumari,

I had faced a similar issue, the reason behind this is you might be using two different VBO's in the flow:

I.e., for create instance, open workbook and show you might be using Excel VBO and for applying filter you might be using Excel Extended so the instance is not getting identified. Please make sure you use a single VBO for all the actions until you close the instance.

Hope this helps,
Regards,
Jeevan Rangaraju

------------------------------
Jeevan R
------------------------------
Jeevan Rangaraju - AD01 Certified RPA Professional Associate Consultant Ernst & Young LLP Bangalore, India Email - jjeevan152@gmail.com

JesperHededam1
Level 5
Hi.

I'm able to replicate this error as well, just by stepping into the Excel VBO when doing an action, and something as simple as opening a code stage, looking at the code, not changing anything and clicking OK to close the code stage is enough to cause this error. Once I've done this, I will keep getting this error until I kind of reset the object and execute again without opening code stages.

It seems the mere fact of opening a code stage causes the connection between the object and the excel instance to be lost. This of course makes developing and testing a pain.

There are probably other ways to trigger this error as well, I just thought I'd chime in with a peculiar find here as well.

------------------------------
Jesper Hededam
Developer
Codan
Europe/Copenhagen
------------------------------

Hi all,

in my own experience, there is a bug here in the MS Excel VBO code. I have just experienced the same frustrating experience during debugging that makes no sense. Jesper Hededam called it out right in my case. Whenever I step into an excel object it loses the connection with the excel workbook. To me I think this means when we run something from the process and instantiate an instance of the object, that instance is different from the one we step into when we then perform a step into function. 

In my case I was opening a report with a formatted Today() date so i stepped into it to change it on the fly and got the 'given key not present in the dictionary but when I stepped over it it worked fine. I can replicate this behaviour ad-inifinitum. To me I understand this as a bug in how Blue Prism is creating objects in memory and then which one is being referenced based on the action you take of stepping over or stepping into it. 

The inverse behaviour is also true, if you step in first and continue stepping in the error doesn't appear, it only appears for me when I stepped over each stage first and then stepped in when I tried to read worksheet as collection.

regards

Dexter



------------------------------
Dexter Whelan
Senior Developer/Mentor
SAS
Europe/London
------------------------------

aaron.diaz
Staff
Staff

Good day Kumari,

You may have already resolved this but I ran into the same issue where we used a component (wrapper object) that the BP software seems to disconnect the object from the Process layer. The way to get this to work is to use the Attach Instance in the Excel object and provide it the full file path and name of the file. This will have an output for the handle to re-establish your connection to then move on to perform other steps for example in my case I was trying to get worksheet name. 
Hope this helps!