Accessing password protected VBA code modules using the Excel object model in VB

  • Is it possible to access Excel VBA macro code objects and modules programatically in VB? If so, how? There must be a better way than just using SendKeys?!!

    Any help appreciated.


  • Hi Kieran,

    In short - no.

    The only way to access a password protected VBAProject (assuming you have the password!) is via SendKeys. And, as you probably realise given the phrasing of your request, SendKeys is not a method that you should place any great reliance on.

    Why the request? If you outline your situation there may be a workaround.

  • Accessing VBA from VB

    Not being an expert in VB I do not know, but can you not simply add a library that contains the Excel or more likely MSOffice objects. Then load up the Excel object, the workbook and reference the code as a property of the object?

    Just thinking......