ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Retrieving List of Macros in Workbook (https://www.excelbanter.com/excel-programming/402192-retrieving-list-macros-workbook.html)

NumberCruncher13

Retrieving List of Macros in Workbook
 
Is there a way to retreive a list of macros stored in the VBA modules
of an excel workbook?

Ashish Dutt Sharma

Retrieving List of Macros in Workbook
 
Hi,
This and more... http://exceltips.vitalnews.com/E089_...ng_Macros.html
Cheers

"NumberCruncher13" wrote:

Is there a way to retreive a list of macros stored in the VBA modules
of an excel workbook?


Bob Phillips

Retrieving List of Macros in Workbook
 
Get hold of MZ Tools for VBA, it has a Statistics option that lists of the
procedures and gives you ... statistics on them.

--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my addy)



"NumberCruncher13" wrote in message
...
Is there a way to retreive a list of macros stored in the VBA modules
of an excel workbook?




NumberCruncher13

Retrieving List of Macros in Workbook
 
On Dec 4, 11:20 am, Ashish Dutt Sharma
wrote:
Hi,
This and more...http://exceltips.vitalnews.com/E089_...ng_Macros.html
Cheers



"NumberCruncher13" wrote:
Is there a way to retreive a list of macros stored in the VBA modules
of an excel workbook?- Hide quoted text -


- Show quoted text -


Ashish,

Thanks for the link. I copied the code from here
http://exceltips.vitalnews.com/Pages...of_Macros.html

But when I run the macro, it looks like my computer stalls, or the
macro is taking too long to run. Have you used this before? Please
let me know if it works for you.

In the directions it states to make sure that the "Microsoft Visual
Basic for Applications Extensibility" is selected. Using my version
of MS Excel 2003, I checked "Microsoft Visual Basic for Applications
Extensibility 5.3"... not sure if that has anything to do with the
problem.

Thanks for you help!

Bob Phillips

Retrieving List of Macros in Workbook
 
This work fine for me, no need to worry about references

Sub ListMacros()
Const vbext_pk_Proc = 0
Dim VBComp As Object
Dim VBCodeMod As Object
Dim oListsheet As Object
Dim StartLine As Long
Dim ProcName As String
Dim iCount As Integer

Application.ScreenUpdating = False
On Error Resume Next
Set oListsheet = ActiveWorkbook.Worksheets.Add
iCount = 1
oListsheet.Range("A1").Value = "Macro"

For Each VBComp In ThisWorkbook.VBProject.VBComponents
Set VBCodeMod =
ThisWorkbook.VBProject.VBComponents(VBComp.Name).C odeModule
With VBCodeMod
StartLine = .CountOfDeclarationLines + 1
Do Until StartLine = .CountOfLines
oListsheet.[a1].Offset(iCount, 0).Value = _
.ProcOfLine(StartLine, vbext_pk_Proc)
iCount = iCount + 1

StartLine = StartLine + _
.ProcCountLines(.ProcOfLine(StartLine, _
vbext_pk_Proc), vbext_pk_Proc)
Loop
End With
Set VBCodeMod = Nothing
Next VBComp

Application.ScreenUpdating = True
End Sub



--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my addy)



"NumberCruncher13" wrote in message
...
On Dec 4, 11:20 am, Ashish Dutt Sharma
wrote:
Hi,
This and more...http://exceltips.vitalnews.com/E089_...ng_Macros.html
Cheers



"NumberCruncher13" wrote:
Is there a way to retreive a list of macros stored in the VBA modules
of an excel workbook?- Hide quoted text -


- Show quoted text -


Ashish,

Thanks for the link. I copied the code from here
http://exceltips.vitalnews.com/Pages...of_Macros.html

But when I run the macro, it looks like my computer stalls, or the
macro is taking too long to run. Have you used this before? Please
let me know if it works for you.

In the directions it states to make sure that the "Microsoft Visual
Basic for Applications Extensibility" is selected. Using my version
of MS Excel 2003, I checked "Microsoft Visual Basic for Applications
Extensibility 5.3"... not sure if that has anything to do with the
problem.

Thanks for you help!




NumberCruncher13

Retrieving List of Macros in Workbook
 
On Dec 5, 4:13 am, "Bob Phillips" wrote:
This work fine for me, no need to worry about references

Sub ListMacros()
Const vbext_pk_Proc = 0
Dim VBComp As Object
Dim VBCodeMod As Object
Dim oListsheet As Object
Dim StartLine As Long
Dim ProcName As String
Dim iCount As Integer

Application.ScreenUpdating = False
On Error Resume Next
Set oListsheet = ActiveWorkbook.Worksheets.Add
iCount = 1
oListsheet.Range("A1").Value = "Macro"

For Each VBComp In ThisWorkbook.VBProject.VBComponents
Set VBCodeMod =
ThisWorkbook.VBProject.VBComponents(VBComp.Name).C odeModule
With VBCodeMod
StartLine = .CountOfDeclarationLines + 1
Do Until StartLine = .CountOfLines
oListsheet.[a1].Offset(iCount, 0).Value = _
.ProcOfLine(StartLine, vbext_pk_Proc)
iCount = iCount + 1

StartLine = StartLine + _
.ProcCountLines(.ProcOfLine(StartLine, _
vbext_pk_Proc), vbext_pk_Proc)
Loop
End With
Set VBCodeMod = Nothing
Next VBComp

Application.ScreenUpdating = True
End Sub

--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"NumberCruncher13" wrote in message

...

On Dec 4, 11:20 am, Ashish Dutt Sharma
wrote:
Hi,
This and more...http://exceltips.vitalnews.com/E089_...ng_Macros.html
Cheers


"NumberCruncher13" wrote:
Is there a way to retreive a list of macros stored in the VBA modules
of an excel workbook?- Hide quoted text -


- Show quoted text -


Ashish,


Thanks for the link. I copied the code from here
http://exceltips.vitalnews.com/Pages..._List_of_Macro...


But when I run the macro, it looks like my computer stalls, or the
macro is taking too long to run. Have you used this before? Please
let me know if it works for you.


In the directions it states to make sure that the "Microsoft Visual
Basic for Applications Extensibility" is selected. Using my version
of MS Excel 2003, I checked "Microsoft Visual Basic for Applications
Extensibility 5.3"... not sure if that has anything to do with the
problem.


Thanks for you help!


Bob -

I copied your code into the vba editor and noticed there's a syntax
error for the following line:
"Set VBCodeMod ="

Did that work for you?

Thanks again for you help.

Bob Phillips

Retrieving List of Macros in Workbook
 
Yes, that is not a coding error, but is caused by the NG wrapping the text.
One of the lines of code was split into two, causing the problem.

Hopefully this is better

Sub ListMacros()
Const vbext_pk_Proc = 0
Dim VBComp As Object
Dim VBCodeMod As Object
Dim oListsheet As Object
Dim StartLine As Long
Dim ProcName As String
Dim iCount As Integer

Application.ScreenUpdating = False
On Error Resume Next
Set oListsheet = ActiveWorkbook.Worksheets.Add
iCount = 1
oListsheet.Range("A1").Value = "Macro"

For Each VBComp In ThisWorkbook.VBProject.VBComponents
Set VBCodeMod = _
ThisWorkbook.VBProject.VBComponents(VBComp.Name).C odeModule
With VBCodeMod
StartLine = .CountOfDeclarationLines + 1
Do Until StartLine = .CountOfLines
oListsheet.[a1].Offset(iCount, 0).Value = _
.ProcOfLine(StartLine, vbext_pk_Proc)
iCount = iCount + 1

StartLine = StartLine + _
.ProcCountLines(.ProcOfLine(StartLine, _
vbext_pk_Proc), vbext_pk_Proc)
Loop
End With
Set VBCodeMod = Nothing
Next VBComp

Application.ScreenUpdating = True
End Sub



--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my addy)



"NumberCruncher13" wrote in message
...
On Dec 5, 4:13 am, "Bob Phillips" wrote:
This work fine for me, no need to worry about references

Sub ListMacros()
Const vbext_pk_Proc = 0
Dim VBComp As Object
Dim VBCodeMod As Object
Dim oListsheet As Object
Dim StartLine As Long
Dim ProcName As String
Dim iCount As Integer

Application.ScreenUpdating = False
On Error Resume Next
Set oListsheet = ActiveWorkbook.Worksheets.Add
iCount = 1
oListsheet.Range("A1").Value = "Macro"

For Each VBComp In ThisWorkbook.VBProject.VBComponents
Set VBCodeMod =
ThisWorkbook.VBProject.VBComponents(VBComp.Name).C odeModule
With VBCodeMod
StartLine = .CountOfDeclarationLines + 1
Do Until StartLine = .CountOfLines
oListsheet.[a1].Offset(iCount, 0).Value = _
.ProcOfLine(StartLine, vbext_pk_Proc)
iCount = iCount + 1

StartLine = StartLine + _
.ProcCountLines(.ProcOfLine(StartLine, _
vbext_pk_Proc), vbext_pk_Proc)
Loop
End With
Set VBCodeMod = Nothing
Next VBComp

Application.ScreenUpdating = True
End Sub

--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my
addy)

"NumberCruncher13" wrote in message

...

On Dec 4, 11:20 am, Ashish Dutt Sharma
wrote:
Hi,
This and
more...http://exceltips.vitalnews.com/E089_...ng_Macros.html
Cheers


"NumberCruncher13" wrote:
Is there a way to retreive a list of macros stored in the VBA
modules
of an excel workbook?- Hide quoted text -


- Show quoted text -


Ashish,


Thanks for the link. I copied the code from here
http://exceltips.vitalnews.com/Pages..._List_of_Macro...


But when I run the macro, it looks like my computer stalls, or the
macro is taking too long to run. Have you used this before? Please
let me know if it works for you.


In the directions it states to make sure that the "Microsoft Visual
Basic for Applications Extensibility" is selected. Using my version
of MS Excel 2003, I checked "Microsoft Visual Basic for Applications
Extensibility 5.3"... not sure if that has anything to do with the
problem.


Thanks for you help!


Bob -

I copied your code into the vba editor and noticed there's a syntax
error for the following line:
"Set VBCodeMod ="

Did that work for you?

Thanks again for you help.





All times are GMT +1. The time now is 10:31 PM.

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