Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default VBA Code to get list of functions in a module.


I have an excel xla add-in called EconLibrary.xla, in it there is
single module which stores all my code, it's called 'AddInCode'.
AddInCode contains several functions, most of which are functions t
use within cells in excel. I need some VBA code that will give me
list (an array would be nice) of all the functions currently containe
in the module. A list like the one in the drop down box is what I'
after. I imagine there is a built in function for getting this array
but I can't find it. Please help! Thank you.

IE:

Dim funclist() As Variant
funclist
Workbooks("EconLibrary.xla").VBProjects.Modules("A ddInCode").Functions.List

obviously thats garbage, but you get the idea

+-------------------------------------------------------------------
|Filename: vbaquestion.JPG
|Download: http://www.excelforum.com/attachment.php?postid=5070
+-------------------------------------------------------------------

--
CalDud
-----------------------------------------------------------------------
CalDude's Profile: http://www.excelforum.com/member.php...fo&userid=3662
View this thread: http://www.excelforum.com/showthread.php?threadid=56375

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 167
Default VBA Code to get list of functions in a module.

To use this code you need to have a reference to "Microsoft Visual Basic For
Applications Extensibility 5.3." This will give you a Messagebox of the
procedures, but you could use the msg variable or mod the code a bit to put
the procedures into an array.


Option Explicit

Sub ListProcedures()

Dim VBCodeMod As CodeModule
Dim StartLine As Long
Dim Msg As String
Dim ProcName As String

Set VBCodeMod = ThisWorkbook.VBProject.VBComponents("Sheet1").Code Module
With VBCodeMod
StartLine = .CountOfDeclarationLines + 1
Do Until StartLine = .CountOfLines
Msg = Msg & .ProcOfLine(StartLine, vbext_pk_Proc) & Chr(13)
StartLine = StartLine + _
.ProcCountLines(.ProcOfLine(StartLine, _
vbext_pk_Proc), vbext_pk_Proc)
Loop
End With
MsgBox Msg

End Sub


Credit to Pearson Software Consulting, LLC (www.cpearson.com)

Mike


"CalDude" wrote:


I have an excel xla add-in called EconLibrary.xla, in it there is a
single module which stores all my code, it's called 'AddInCode'.
AddInCode contains several functions, most of which are functions to
use within cells in excel. I need some VBA code that will give me a
list (an array would be nice) of all the functions currently contained
in the module. A list like the one in the drop down box is what I'm
after. I imagine there is a built in function for getting this array,
but I can't find it. Please help! Thank you.

IE:

Dim funclist() As Variant
funclist =
Workbooks("EconLibrary.xla").VBProjects.Modules("A ddInCode").Functions.List

obviously thats garbage, but you get the idea!


+-------------------------------------------------------------------+
|Filename: vbaquestion.JPG |
|Download: http://www.excelforum.com/attachment.php?postid=5070 |
+-------------------------------------------------------------------+

--
CalDude
------------------------------------------------------------------------
CalDude's Profile: http://www.excelforum.com/member.php...o&userid=36628
View this thread: http://www.excelforum.com/showthread...hreadid=563755


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
code in module A to not execute a Worksheet_SelectionChange sub of another module Jack Sons Excel Discussion (Misc queries) 4 December 11th 05 11:52 PM
copying vba code to a standard code module 1vagrowr Excel Discussion (Misc queries) 2 November 23rd 05 04:00 PM
Run worksheet module code from workbook module? keithb Excel Programming 1 August 14th 05 04:04 AM
Create a newworksheet with VBA code and put VBA code in the new worksheet module ceshelman Excel Programming 4 June 15th 05 04:37 PM
Sheet Code Module: copying code to [email protected][_2_] Excel Programming 2 December 14th 04 01:57 AM


All times are GMT +1. The time now is 08:58 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"