Reputation: 239
Case: I have a app written in C#. This app opens VBA Projects (Word). Some VBA Projects are password protected. I use this two libraries:
using Microsoft.Office.Interop.Word;
using Microsoft.Vbe.Interop;
Problem: How can I programmatically open the password protected ones? I'm thinking about popping a window to the user with "Enter password" or something similar.
Upvotes: 2
Views: 4507
Reputation: 427
There is a way to unprotect VBA project for Excel file. So let see if you can apply similar approach for Word VBA project
you can find the solution from Siddharth Rout in the below post.
Unprotect VBProject from VB code
Upvotes: 2
Reputation: 239
Unprotecting a "word document" is implemented. But unfortunately there is no method to unprotect a "protected VBA project".
Workarround: With the read only "Protection" field, I check if it's protected and skip this VBA project. After that I show a list with skipped projects to the user.
Set Excel VBA project to be password protected using C#
How to unlock protected vbaproject in a excel file from C#?
Upvotes: 1