Board index » Visual Studio » extract names of all subs and functions

extract names of all subs and functions

Visual Studio375
Hi,

How can I extract the names of all subs and functions in my classes? There

are well over 200 and I'm looking for an easy and more accurate way to do it

besides copy and paste.



I simply need a list that can be printed out and used as a checklist. I

need only the names, the parameters are not important.



Any ideas? How to do it quickly?



Is there a utility in VB that can do this? Or does you know how to apply

regular expressions to such a task?



Thanks!!

Rogue Petunia


-
 

Re:extract names of all subs and functions



"Rogue Petunia" <roguepetunia@NOSPAMnyc.rr.com>wrote in message

Quote
Hi,

How can I extract the names of all subs and functions in my classes? There

are well over 200 and I'm looking for an easy and more accurate way to do it

besides copy and paste.



I simply need a list that can be printed out and used as a checklist. I

need only the names, the parameters are not important.



Any ideas? How to do it quickly?



Is there a utility in VB that can do this? Or does you know how to apply

regular expressions to such a task?



Thanks!!



Search for MZ Tools. I think it's what you want.



Jim Edgar

Quote
Rogue Petunia









-

Re:extract names of all subs and functions



"Rogue Petunia" <roguepetunia@NOSPAMnyc.rr.com>wrote in message

Quote
Hi,

How can I extract the names of all subs and functions in my classes?

There

are well over 200 and I'm looking for an easy and more accurate way to do

it

besides copy and paste.



I simply need a list that can be printed out and used as a checklist. I

need only the names, the parameters are not important.



Any ideas? How to do it quickly?



Is there a utility in VB that can do this? Or does you know how to apply

regular expressions to such a task?





Nothing built-in to VB to do this. A number of add-ins can do something

close to (if not exactly) what you apparently want. IOW, the add-in may

provide a list of all procedures, but you'd probably have to take additional

steps to print it out and use it as a checklist (what are you checking,

BTW?).



In any case, it wouldn't be too hard to write VB program (or your own

add-in) to do *exactly* what you want. It sure doesn't sound as if what you

want would be difficult to write.



Mike





-

Re:extract names of all subs and functions



"Jim Edgar" <djedgarNOSPAM@cox.net>wrote in message

Quote


"Rogue Petunia" <roguepetunia@NOSPAMnyc.rr.com>wrote in message

news:OtYknBUNEHA.2244@tk2msftngp13.phx.gbl...

>Hi,

>How can I extract the names of all subs and functions in my classes?

There

>are well over 200 and I'm looking for an easy and more accurate way to

do it

>besides copy and paste.

>

>I simply need a list that can be printed out and used as a checklist. I

>need only the names, the parameters are not important.

>

>Any ideas? How to do it quickly?

>

>Is there a utility in VB that can do this? Or does you know how to

apply

>regular expressions to such a task?

>

>Thanks!!



Search for MZ Tools. I think it's what you want.



Jim Edgar

>Rogue Petunia

>



I have MZTools. It doesn't do that.





-

Re:extract names of all subs and functions



"MikeD" <nobody@nowhere.edu>wrote in message

Quote


"Rogue Petunia" <roguepetunia@NOSPAMnyc.rr.com>wrote in message

news:OtYknBUNEHA.2244@tk2msftngp13.phx.gbl...

>Hi,

>How can I extract the names of all subs and functions in my classes?

There

>are well over 200 and I'm looking for an easy and more accurate way to

do

it

>besides copy and paste.

>

>I simply need a list that can be printed out and used as a checklist. I

>need only the names, the parameters are not important.

>

>Any ideas? How to do it quickly?

>

>Is there a utility in VB that can do this? Or does you know how to

apply

>regular expressions to such a task?





Nothing built-in to VB to do this. A number of add-ins can do something

close to (if not exactly) what you apparently want. IOW, the add-in may

provide a list of all procedures, but you'd probably have to take

additional

steps to print it out and use it as a checklist (what are you checking,

BTW?).



In any case, it wouldn't be too hard to write VB program (or your own

add-in) to do *exactly* what you want. It sure doesn't sound as if what

you

want would be difficult to write.



Mike





MZ Tools provides a list of procedures in its Sort Procedures feature but

the list can't be copied to a clipboard.



I'm going through the code and adding errorhandling to all the subs and

routines. I'd like to have a physical checklist to tick them off as I go

being as I won't get it all done in one sitting and don't want to lose track

of where I am, what I've done, etc.



I'm sure it wouldn't be difficult to write but I don't have the time to play

around with it. Was hoping someone had already done this for themselves and

had it sitting around and would share it :)



Rogue Petunia





-

Re:extract names of all subs and functions



"Rogue Petunia" <roguepetunia@NOSPAMnyc.rr.com>wrote in message

Quote


"Jim Edgar" <djedgarNOSPAM@cox.net>wrote in message

news:%23kRBtHUNEHA.2644@TK2MSFTNGP11.phx.gbl...

>

>"Rogue Petunia" <roguepetunia@NOSPAMnyc.rr.com>wrote in message

>news:OtYknBUNEHA.2244@tk2msftngp13.phx.gbl...

>>Hi,

>>How can I extract the names of all subs and functions in my classes?

There

>>are well over 200 and I'm looking for an easy and more accurate way to

do it

>>besides copy and paste.

>>

>>I simply need a list that can be printed out and used as a checklist. I

>>need only the names, the parameters are not important.

>>

>>Any ideas? How to do it quickly?

>>

>>Is there a utility in VB that can do this? Or does you know how to

apply

>>regular expressions to such a task?

>>

>>Thanks!!

>

>Search for MZ Tools. I think it's what you want.

>

>Jim Edgar

>>Rogue Petunia

>>



I have MZTools. It doesn't do that.







MZTools can save your project as an XML file. Parse the file and look

for declarations. ie



Private Sub Command1_Click()

Dim lNum As Long

Dim vData

Dim sData As String

Dim iCnt As Long

Dim sFile As String



sFile = App.Path & "\myXML.xml"

lNum = FreeFile

Open sFile For Binary As #lNum

sData = Space(LOF(lNum))

Get #lNum, , sData

' Done with the file so close it.

Close #lNum

vData = Split(sData, vbCrLf)

For iCnt = 0 To UBound(vData) - 1

' Hopefully you don't use underscores in your declarations.

If Left(vData(iCnt), 13) = "<Declaration>" And InStr(vData(iCnt), "_") = 0 Then

' Print to a file or whatever

Debug.Print Replace(Replace(vData(iCnt), "<Declaration>", ""),

"</Declaration>", "")

End If

Next

End Sub



Jim Edgar





-

Re:extract names of all subs and functions



"Rogue Petunia" <roguepetunia@NOSPAMnyc.rr.com>wrote in message



Quote
MZ Tools provides a list of procedures in its Sort Procedures feature but

the list can't be copied to a clipboard.



I'm going through the code and adding errorhandling to all the subs and

routines. I'd like to have a physical checklist to tick them off as I go

being as I won't get it all done in one sitting and don't want to lose

track

of where I am, what I've done, etc.



I know of nothing that would serve that exact purpose. Sorry.



Quote


I'm sure it wouldn't be difficult to write but I don't have the time to

play

around with it. Was hoping someone had already done this for themselves

and

had it sitting around and would share it :)





I can't imagine something as simple as what you want taking more than a

couple hours to write (assuming a decent knowledge of VB and what the source

code files look like as plain text, for example in Notepad). Given the time

as of I'm writing this reply from the time you first posted your original

message, it's already been about 1.5 hours. You could have been 90% done

with it (give or take, depending on how fast you can write code compared to

me, and I'll admit that I'm slow at writing code). <g>



Mike





-

Re:extract names of all subs and functions

You can even add the form name to your printout.



Private Sub Command1_Click()

Dim lNum As Long

Dim vData

Dim sData As String

Dim iCnt As Long

Dim sFile As String

Dim bNewForm As Boolean

Dim sFormName As String



sFile = App.Path & "\myXML.xml"

lNum = FreeFile

Open sFile For Binary As #lNum

sData = Space(LOF(lNum))

Get #lNum, , sData

' Done with the file so close it.

Close #lNum

vData = Split(sData, vbCrLf)

For iCnt = 0 To UBound(vData) - 1

If Left(vData(iCnt), 6) = "<File>" Then

bNewForm = True

End If

If Left(vData(iCnt), 6) = "<Name>" And bNewForm Then

sFormName = Replace(Replace(vData(iCnt), "<Name>", ""), "</Name>", "")

bNewForm = False

End If

If Left(vData(iCnt), 13) = "<Declaration>" And InStr(vData(iCnt), "_") = 0 Then

Debug.Print sFormName & " -->" & Replace(Replace(vData(iCnt),

"<Declaration>", ""), "</Declaration>", "")

End If

Next

End Sub



Or you could use the MicroSoft XML parser.



JEdgar





-

Re:extract names of all subs and functions

Rogue Petunia wrote:



Quote
I'm going through the code and adding errorhandling to all the subs and

routines. I'd like to have a physical checklist to tick them off as I go

being as I won't get it all done in one sitting and don't want to lose track

of where I am, what I've done, etc.





well, screw the reporting then --



write yourself a procedure to insert error handlers, or use one of the MANY tools

(including MZTools) which can do so. Almost all of them are wonderfully customizable.







Bob

--

-

Re:extract names of all subs and functions



"MikeD" <nobody@nowhere.edu>wrote in message

Quote


"Rogue Petunia" <roguepetunia@NOSPAMnyc.rr.com>wrote in message

news:ugw$5fUNEHA.740@TK2MSFTNGP12.phx.gbl...



>MZ Tools provides a list of procedures in its Sort Procedures feature

but

>the list can't be copied to a clipboard.

>

>I'm going through the code and adding errorhandling to all the subs and

>routines. I'd like to have a physical checklist to tick them off as I

go

>being as I won't get it all done in one sitting and don't want to lose

track

>of where I am, what I've done, etc.



I know of nothing that would serve that exact purpose. Sorry.



>

>I'm sure it wouldn't be difficult to write but I don't have the time to

play

>around with it. Was hoping someone had already done this for themselves

and

>had it sitting around and would share it :)





I can't imagine something as simple as what you want taking more than a

couple hours to write (assuming a decent knowledge of VB and what the

source

code files look like as plain text, for example in Notepad). Given the

time

as of I'm writing this reply from the time you first posted your original

message, it's already been about 1.5 hours. You could have been 90% done

with it (give or take, depending on how fast you can write code compared

to

me, and I'll admit that I'm slow at writing code). <g>



Mike



Mike,

2 things. 1) Yes, I'm slow at writing code. 2) during the time I first

posted the question and your reply I wasn't just twiddling my thumbs. I was

working on other stuff. Notice, it's the weekend and I'm at work - there is

little time to spare ;)



Rogue Petunia





-

Re:extract names of all subs and functions



"Bob O`Bob" <filterbob@yahoogroups.com>wrote in message

Quote
Rogue Petunia wrote:



>I'm going through the code and adding errorhandling to all the subs and

>routines. I'd like to have a physical checklist to tick them off as I

go

>being as I won't get it all done in one sitting and don't want to lose

track

>of where I am, what I've done, etc.





well, screw the reporting then --



write yourself a procedure to insert error handlers, or use one of the

MANY tools

(including MZTools) which can do so. Almost all of them are wonderfully

customizable.







Bob

--



Bob,

I have MZTools and I'm using it to insert the errorhandlers. You must

insert them into each procedure independently. We have 319 procedures. I

just don't want to miss any.





-

Re:extract names of all subs and functions

Neat. I'm going to have to find that and see how Access reads

the XML.



--

Jim Carlock

www.microcosmotalk.com/">www.microcosmotalk.com/

Post replies to the newsgroup.





"Jim Edgar" <djedgarNOSPAM@cox.net>wrote in message

You can even add the form name to your printout.



Private Sub Command1_Click()

Dim lNum As Long

Dim vData

Dim sData As String

Dim iCnt As Long

Dim sFile As String

Dim bNewForm As Boolean

Dim sFormName As String



sFile = App.Path & "\myXML.xml"

lNum = FreeFile

Open sFile For Binary As #lNum

sData = Space(LOF(lNum))

Get #lNum, , sData

' Done with the file so close it.

Close #lNum

vData = Split(sData, vbCrLf)

For iCnt = 0 To UBound(vData) - 1

If Left(vData(iCnt), 6) = "<File>" Then

bNewForm = True

End If

If Left(vData(iCnt), 6) = "<Name>" And bNewForm Then

sFormName = Replace(Replace(vData(iCnt), "<Name>", ""),

"</Name>", "")

bNewForm = False

End If

If Left(vData(iCnt), 13) = "<Declaration>" And InStr(vData(iCnt),

"_") = 0 Then

Debug.Print sFormName & " -->" & Replace(Replace(vData(iCnt),

"<Declaration>", ""), "</Declaration>", "")

End If

Next

End Sub



Or you could use the MicroSoft XML parser.



JEdgar







-

Re:extract names of all subs and functions

Rogue Petunia wrote:



Quote
I have MZTools and I'm using it to insert the errorhandlers. You must

insert them into each procedure independently. We have 319 procedures. I

just don't want to miss any.





Oh. I haven't done that with MZ.

Didn't realize it was individual.

None of the other tools I've used in the past were.



We should probably encourage the author to fix that.



Unfortunately I can't recommend another these days,

as I haven't automated that task since the VB4 days.

(my favorite then was called "Start Developing")







Bob

-

Re:extract names of all subs and functions



"Rogue Petunia" <roguepetunia@NOSPAMnyc.rr.com>wrote in message

Quote
Mike,

2 things. 1) Yes, I'm slow at writing code. 2) during the time I first

posted the question and your reply I wasn't just twiddling my thumbs. I

was

working on other stuff. Notice, it's the weekend and I'm at work - there

is

little time to spare ;)





I sympathize with your plight. I know what it's like to be up against a

deadline that's fast approaching. Usually, however, it's really the fault

of the programmer that the deadline has become so tight. Whenever deadlines

have gotten tight for me, it's usually been my own fault because I misjudged

how long it would take me to complete the task, and that's usually because I

didn't take "other things" into consideration when giving my estimate of how

long it would take. In those situations, I blame nobody but myself because

I'm the one who really set the deadline (by having said I could have it done

by a certain date).



But, I still think you're wasting more (and precious) time posting to the

newsgroups in the hope that somebody will have written exactly what you

need. Estimate how much time you've spent writing your posts, reading

replies, responding to replies, etc. I'd be very willing to bet that if you

did NONE of that, you could have written something to do what you want in

that same amount of time.



I don't mean to sound harsh. I'm just saying what I think.



Oh...let me give you a "real world" example of my own. A couple of years

ago, I started work with a new employer and inherited an application. This

application was not yet into production and was more than 1 year overdue

(that's why most of the original developers got fired and I subsequently got

hired as the lead). All my employer wanted was to get this app into

production and functioning "reliably" and they basically dictated 4 weeks to

do it (they were willing to forego features they really wanted but were no

where near close to getting implemented, which was based on me looking over

the program for about 2 days and giving a judgement of what I thought could

be done in 4 weeks). One of the "major" problems with this program was that

Option Explicit was not used in hardly any modules, and I determined very

quickly that this was the cause of many problems in the app (that's one of

the first things I look for when inheriting an app). This was a fairly

large project, consisting of about 50 forms, 20 or so standard modules, and

20 or so class modules (and all of this part of a single EXE project). Now

I wasn't about to go through all of these modules within the IDE looking for

Option Explicit. Instead, I wrote, in about an hour, a simple VB program to

read each source file and check if Option Explicit was in the file...and if

not, add it. This saved me countless hours. I didn't "waste" time going to

newsgroups or whatever asking if somebody knew of something to do this

already. I knew it would take me less time to just write it.



The newsgroups are great. They can be a very valuable resource. But they're

not always the best means of solving a problem. In my opinion, you've

wasted a lot of valuable time which you probably could have put to better

use.



Mike







-

Re:extract names of all subs and functions

MikeD wrote:

Quote


....

The newsgroups are great. They can be a very valuable resource. But they're

not always the best means of solving a problem. In my opinion, you've

wasted a lot of valuable time which you probably could have put to better

use.



But a guy's gotta' take a break sometimes, anyway...although I grant

your point.

-

Re:extract names of all subs and functions

"Rogue Petunia" <roguepetunia@NOSPAMnyc.rr.com>'s wild

thoughts were released on Sat, 8 May 2004 17:06:58 -0400

bearing the following fruit:



Quote
Hi,

How can I extract the names of all subs and functions in my classes? There

are well over 200 and I'm looking for an easy and more accurate way to do it

besides copy and paste.



I simply need a list that can be printed out and used as a checklist. I

need only the names, the parameters are not important.



Any ideas? How to do it quickly?



Is there a utility in VB that can do this? Or does you know how to apply

regular expressions to such a task?





The following free tool may help



www.MZTools.com











--

Jan Hyde (MVP - Visual Basic)



When ancient wall sculptors were finished, it was a relief. (David Kahn)



[Abolish the TV Licence - www.tvlicensing.biz/]">www.tvlicensing.biz/]



-