Problem with vbext_pk_Proc

  • Thread starter Thread starter davidm
  • Start date Start date
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
 
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.
 
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.
 
Hi davidm,
Simply, replace vbext_pk_Proc by 0 (no need reference to Microsoft Visual
Basic Extensibility library)

MP
 
Back
Top