Get a list of macros in a module

Get a list of macros in a module

Anonymous
Not applicable
379 Views
5 Replies
Message 1 of 6

Get a list of macros in a module

Anonymous
Not applicable
Is it possible to get a list of procedures in a module.
I would like to provide a form that presents the User with a list of macros
similar to the macro dialog box in AutoCAD (ALT+F8)

--
Regards
Tom Roberts
__________________________
MechWest Design & Drafting
Perth, Western Australia
0 Likes
380 Views
5 Replies
Replies (5)
Message 2 of 6

Anonymous
Not applicable
Sure, find a copy of my FREE macro recorder. That should get you started.

Joe
--

"Tom Roberts" wrote in message
news:4861347@discussion.autodesk.com...
Is it possible to get a list of procedures in a module.
I would like to provide a form that presents the User with a list of macros
similar to the macro dialog box in AutoCAD (ALT+F8)

--
Regards
Tom Roberts
__________________________
MechWest Design & Drafting
Perth, Western Australia
0 Likes
Message 3 of 6

Anonymous
Not applicable
Use these previous posts to show you an example of the proper reference and objects you would use to satisfy your request.

http://discussion.autodesk.com/thread.jspa?messageID=396801
http://discussion.autodesk.com/thread.jspa?messageID=431258
http://discussion.autodesk.com/thread.jspa?messageID=4243969

If these don't help post back, expain what you need or don't understand, and I'm sure someone will assit you with the code

Good luck,

Bob Coward
CADS, Inc
0 Likes
Message 4 of 6

Anonymous
Not applicable
Joe
>find a copy of my FREE macro recorder
Where ?
Thanks
--
Bernard Flavignard

"Joe Sutphin" a écrit dans le message de news:
4861555@discussion.autodesk.com...
Sure, find a copy of my FREE macro recorder. That should get you started.

Joe
--

"Tom Roberts" wrote in message
news:4861347@discussion.autodesk.com...
Is it possible to get a list of procedures in a module.
I would like to provide a form that presents the User with a list of macros
similar to the macro dialog box in AutoCAD (ALT+F8)

--
Regards
Tom Roberts
__________________________
MechWest Design & Drafting
Perth, Western Australia
0 Likes
Message 5 of 6

Anonymous
Not applicable
Right here, I have attached it.

Joe
--

"Bernard Flavignard" wrote in message
news:4862576@discussion.autodesk.com...
Joe
>find a copy of my FREE macro recorder
Where ?
Thanks
--
Bernard Flavignard

"Joe Sutphin" a écrit dans le message de news:
4861555@discussion.autodesk.com...
Sure, find a copy of my FREE macro recorder. That should get you started.

Joe
--

"Tom Roberts" wrote in message
news:4861347@discussion.autodesk.com...
Is it possible to get a list of procedures in a module.
I would like to provide a form that presents the User with a list of macros
similar to the macro dialog box in AutoCAD (ALT+F8)

--
Regards
Tom Roberts
__________________________
MechWest Design & Drafting
Perth, Western Australia
0 Likes
Message 6 of 6

Anonymous
Not applicable
This function I wrote just outputs to the Immediate window, but you could
modify it to write to a dialog control.

Public Sub EnumCode()
'enumerate the procedures in a project
Dim objVB As VBE
Dim objComponents As VBComponents
Dim objComponent As VBComponent
Dim objCM As CodeModule
Dim cnt As Integer
Dim l As Long
Dim strLine As String
Dim strProc As String
Dim strProc1 As String

Set objVB = ThisDrawing.Application.VBE
Set objComponents = objVB.ActiveVBProject.VBComponents
For Each objComponent In objComponents
Set objCM = objComponent.CodeModule
Debug.Print objComponent.Name
cnt = objCM.CountOfLines
For l = 1 To cnt
strLine = objCM.Lines(l, 1)
strProc = objCM.ProcOfLine(l, vbext_pk_Proc)
'only print procedure line once per procedure
If strProc <> "" And strProc <> strProc1 Then
Debug.Print vbTab & strProc
strProc1 = strProc
End If
Next l
Next objComponent
End Sub

--
----
Ed
----
"Tom Roberts" wrote in message
news:4861347@discussion.autodesk.com...
Is it possible to get a list of procedures in a module.
I would like to provide a form that presents the User with a list of macros
similar to the macro dialog box in AutoCAD (ALT+F8)

--
Regards
Tom Roberts
__________________________
MechWest Design & Drafting
Perth, Western Australia
0 Likes