ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Identifying PERSONAL.XLSB macros (https://www.excelbanter.com/excel-programming/454969-identifying-personal-xlsb-macros.html)

[email protected]

Identifying PERSONAL.XLSB macros
 
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

[email protected]

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.

Peter T[_8_]

Identifying PERSONAL.XLSB macros
 
" 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



[email protected]

Identifying PERSONAL.XLSB macros
 
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.

Peter T[_8_]

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




All times are GMT +1. The time now is 07:02 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com