cancel
Showing results for 
Search instead for 
Did you mean: 

Modified Excel VBO - with open password protected Workbook

SamanthaShaw
Staff
Staff
Attached should be a modified Excel VBO with an extra action to open a password protected Workbook. Please note that this is supplied "as is" and is not an official part of the Blue Prism product. There are enhancement requests also logged to add further functionality of this nature and more to the Excel VBO that ships with the product. Sam
15 REPLIES 15

I amended the code in the existing 'Open Workbook' action as follows where 'password' is a reference to a Password Data Item Input: Dim wb as Object = GetInstance(handle).Workbooks.Open(filename, Type.Missing, Type.Missing, Type.Missing, password) name = wb.Name wb.Activate()

Thanks for posting this niallfee. I just recently figured out the code myself and came here to post it. I'm following more or less the same logic myself but lack knowledge of Visual Basic and I'm not sure what the function of the Type.Missing objects. Would you be able to explain these? In addition to the above, I included WriteResPassword in my own, if in the case of files having separate write/read credentials. These can be set to whatever data item inputs you need. As a bonus, there's no issue using the amended code if the files you are opening do not have password access enabled. Dim wb as Object = GetInstance(handle).Workbooks.Open(filename,Password:=(Password),WriteResPassword:=(Password)) name = wb.Name wb.Activate()

Hi Daragh, I think the Type.Missing just invokes the default value for the parameter at that position. I'm very new to this too so it probably isn't the best way to write it! My code is just using filename for the first parameter, then using Type.Missing to get the default for the next 3 parameters and then using password for the fifth parameter. I guess your approach is explicitly calling out and assigning the password parameters rather than going through the list until it gets to them like mine. https://msdn.microsoft.com/en-us/library/microsoft.office.interop.excel

OK I think I get where you're coming from. Thanks!

HamidSabaro1
Level 2
Hi can someone forward the VBO to hamid.sabaro@teliacompany.com Thanks in advance!

IL
Level 2
If anyone could link the VBO that would be great! Thanks!