Problem with vbext_pk_Proc

D

davidm

I am having trouble running the following (CPearson's) code.

Sub ListProcedures()
Dim VBCodeMod As CodeModule
Dim StartLine As Long
Dim Msg As String
Dim ProcName As String
Set VBCodeMod
ThisWorkbook.VBProject.VBComponents("SaveModule").CodeModule
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

Excel balks at vbext_pk_Proc. In the past, when some such problem wa
encountered, I squirmed out of trouble by using the numerical constan
values - as in using 1 for vbext_ct_stdModule, 100 fo
vbext_ct_document etc. The Help files do not seem to give the numeri
constant for vbext_pk_Proc. Any help will be appreciated
 
T

Tom Ogilvy

In tools=>references in the VBE, create a reference to the Microsoft Visual
Basic Extensibility library. I believe this is stated at the top of Mr.
Pearson's web page.
 
D

Dick Kusleika

Try setting a reference (Tools - Reference) to the Microsoft Visual Basic
for Extensibility Library. Hit F2 for the object browser and you can search
or browse through the constant definitions. In the object browser, choose
VBIDE as the library and look for vbext_ProcKind as the Type.

It's zero, by the way.
 
M

Michel Pierron

Hi davidm,
Simply, replace vbext_pk_Proc by 0 (no need reference to Microsoft Visual
Basic Extensibility library)

MP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top