VBE CountOfLines...
CADForums.net Forum Index CADForums.net
Discussion of AutoCAD and other CAD software.
 
 FAQFAQ   MemberlistMemberlist     RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
Google
 
Web cadforums.net
VBE CountOfLines...

 
Post new topic   Reply to topic    CADForums.net Forum Index -> VBA
Author Message
Matt W
Guest





Posted: Thu Jan 13, 2005 1:05 am    Post subject: VBE CountOfLines... Reply with quote

I'm trying to write a little program that will count the number of lines in
any sub, function, etc... but I can't seem to figure out the CountOfLines
portion.
Right now, it's giving me a count of ALL of the lines of code.

Here's what I've got so far...

Sub TEST()
Dim objVBE As VBIDE.VBE
Dim objProc As String
Dim lngSL As Long, lngSC As Long, lngEL As Long, lngEC As Long
Set objVBE = ThisDrawing.Application.VBE
Debug.Print objVBE.ActiveCodePane.CodeModule
objVBE.ActiveCodePane.GetSelection lngSL, lngSC, lngEL, lngEC
objProc = objVBE.ActiveCodePane.CodeModule.ProcOfLine(lngSL,
vbext_pk_Get)
Debug.Print objProc
Debug.Print objVBE.ActiveCodePane.CodeModule.CountOfLines
Set objVBE = Nothing
End Sub

Thanks in advance!

--
I support two teams: The Red Sox and whoever beats the Yankees.

Back to top
fantum
Guest





Posted: Thu Jan 13, 2005 2:09 am    Post subject: Re: VBE CountOfLines... Reply with quote

Try

Debug.Print objVBE.ActiveCodePane.CodeModule.ProcCountLines(objProc, vbext_pk_Get)
Back to top
Matt W
Guest





Posted: Thu Jan 13, 2005 2:18 am    Post subject: Re: VBE CountOfLines... Reply with quote

No dice.
I get RT Error 35 "No Sub of Function Defined".

--
I support two teams: The Red Sox and whoever beats the Yankees.

"fantum" <nospam@address.withheld> wrote in message
news:27019366.1105564207299.JavaMail.jive@jiveforum1.autodesk.com...
Quote:
Try

Debug.Print objVBE.ActiveCodePane.CodeModule.ProcCountLines(objProc,
vbext_pk_Get)


Back to top
Matt W
Guest





Posted: Thu Jan 13, 2005 2:44 am    Post subject: Re: VBE CountOfLines... Reply with quote

Figured it out...
It should be Debug.Print
objVBE.ActiveCodePane.CodeModule.ProcCountLines(objProc, vbext_pk_Proc)
instead.

--
I support two teams: The Red Sox and whoever beats the Yankees.

"Matt W" <nospam@address.withheld.com> wrote in message
news:41e5941b_3@newsprd01...
Quote:
No dice.
I get RT Error 35 "No Sub of Function Defined".

--
I support two teams: The Red Sox and whoever beats the Yankees.

"fantum" <nospam@address.withheld> wrote in message
news:27019366.1105564207299.JavaMail.jive@jiveforum1.autodesk.com...
Try

Debug.Print objVBE.ActiveCodePane.CodeModule.ProcCountLines(objProc,
vbext_pk_Get)

Back to top
fantum
Guest





Posted: Thu Jan 13, 2005 2:50 am    Post subject: Re: VBE CountOfLines... Reply with quote

Unless you want the line count of a property procedure.
Back to top
 
Post new topic   Reply to topic    CADForums.net Forum Index -> VBA All times are GMT
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum




Windows Server DSP VoIP Electronics New Topics
Powered by phpBB