View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
[email protected] deasmhuin...@gmail.com is offline
external usenet poster
 
Posts: 3
Default Identifying PERSONAL.XLSB macros

On Saturday, October 24, 2020 at 12:25:44 PM UTC-4, wrote:
In my development environment, I make extensive use of a self developed library of useful macros (function or subroutine) that I maintain in PERSONAL.XLSB.

Is there any way I can get VBA to examine an application's code base and provide me with a list of PERSONAL.XLSB macros being called.

This is motivated by a problem I am anticipating in publishing a VBA application as an AddIn. I assume all PERSONAL.XLSB's macros being called by the application would have to be explicitly added to the AddIn code base.

Thank you


I have done some more investigations. It is easy to get a list of the procedures in PERSONAL.XLSB (or any workbook) using CodeModule methods (.ProcOfLines, .ProcCountLines). The same methods will provide an application's source code. By scanning through the source code and checking for the occurrence of any member of the PERSONAL.XLSB procedure list (using .Find or regular expressions) one should arrive at a list of the PERSONAL.XLSB procedures being called. These could then be programatically inserted into a new Module in the AddIn.

Of course there are details to be looked after. For instance the mention of a PERSONAL.XLSB procedure in a comment line needs to be ignored. Also, a PERSONAL.XLSB procedure may call another PERSONAL.XLSB procedure so a recursive check would need to be made.

But, it can be done. The main difficulty is that the Excel Object model does not provide direct support for procedures and one has to extract procedure information indirectly.