Finding problems with dynamically import / execute / delete excel VBA module

Summary: So I have a book that has been circulated and will need to be updated occasionally. After some research and research, I selected the book to import the .bas network file (Visual Basic Code Module), execute the module code to update the said book, and finally delete the module when finished.

Problem: I was wondering if there could be any problems with this method as it works and is too easy to implement compared to an add-on, for example.

My code is simple, in the workbook_open event I import and run the "update" module:

1) VBproject.vbcomponents.Import MyModule

2) Execute MyModules code

3) VBproject.vbcomponents.remove MyModule

(2) and (3) terminate in another subroutine, otherwise the module methods are not recognized after import and cannot be used.

Thanks in advance for any issues that may arise.

If the question is too vague or open-ended, let me know and I will delete it, or, alternatively, I can provide additional information.

Thanks in advance guys

+3


source to share


1 answer


The main problem I can think of is that you need your users to accept a value for this to work Trust access to the VBA project object model

.

They may not want it, reasonably, or be banned because it comes with some security risks.



Imagine someone succeeds in dropping a malicious file .bas

with the same name and your location. You need to take action against this and convince users and especially security administrators ...

0


source







All Articles