View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Peter T[_8_] Peter T[_8_] is offline
external usenet poster
 
Posts: 88
Default Identifying PERSONAL.XLSB macros

" wrote in message
On Sunday, October 25, 2020 at 12:31:39 PM UTC-4, Peter T wrote:
" wrote in message
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.

What do you mean by "with a list of the macros being called". For example
a
list of all Sub's in Personal.xlsb, or the routines called in personal
called by your adddin, or something else...?

Peter T

My AddIn application will consist of a number of VBA procedures (function or
subroutine). These may contain calls to another set of VBA procedures that
reside in my PERSONAL.XLSB. And these directly called PERSONAL.XLSB
procedures may also be calling other PERSONAL.XLSB procedures. Since my
AddIn application will need to run on machines that do not have access to my
PERSONAL.XLSB, the AddIn codebase will have to contain all the VBA code that
may be called during application execution. That is why I am developing an
application to identify the set of PERSONAL.XLSB procedures being used and
copying them into a new module of my AddIn.


=========
There's nothing off the shelf I'm aware of. Various approaches, which would
be most efficient would depend on how many procedures potentially you need
to map, and how familiar you are with the VBA Extensibility object model (to
produce a listing of all the procedures in your personal and what procedures
they in turn might call.

If not dealing with many proc's maybe something simple like this might be
all you need -
Add the following to each proc in your personal -

Static bCalled As Boolean
If Not bCalled Then
Debug.Print "this proc name"
bCalled = True
End If

Run whatever it takes to ensure all proc's in your personal get called and
you should get a listing in the immediate window. With personal the active
project press the reset button to clear all the static variables.

You'd probably find 'MZ tools' useful if you don't already have it.

Peter T