Results 1 to 3 of 3
  1. #1
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Yilgarn region of Toronto, Ontario
    Posts
    5,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    determine the procedure type (Word97-SR2/VBE)

    For the life of me (not worth much, I know) I can't see how to determine the procedure type of a line before I try to determine what procedure it is.


    Reproduced below is my code as it now stands. Works fin up to now, because I've only dealt with User modules (that we all know and love)

    <pre>strAr0= strName
    strAr1= objMod.CodeModule.ProcStartLine(strName, vbext_pk_Proc)
    strAr2= objMod.CodeModule.ProcCountLines(strName, vbext_pk_Proc)
    strAr3= objMod.CodeModule.Lines(I1, I2)
    </pre>



    However, there are four types of procedures in a module, and while those of type vbext_pk_Proc can exist in a Class Module (shudder!), the class module can also have procedures of type vbext_pk_Let, vbext_pk_Set or vbext_pk_Proc.

    (VBE Help)
    vbext_pk_Get Specifies a procedure that returns the value of a property.
    vbext_pk_Let Specifies a procedure that assigns a value to a property.
    vbext_pk_Set Specifies a procedure that sets a reference to an object.
    vbext_pk_Proc Specifies all procedures other than property procedures.
    (/VBE Help)


    My code segment (above) bombs out as soon as I run into a Get, Let or Set within a class module, but I can see nothing in the Help files that tells me how to detect the type of procedure for a given line.

    I could live with something that looked like this in pseudocode:
    <pre>If proc is of type ext then
    do my original code (above)
    else
    if proc is of type get then
    do a get-type of thing
    else
    if proc is of type let then
    do a let-kind of thing
    else
    if proc is of kind set then
    do a set-kind of thing
    else
    problem?
    endif
    endif
    endif
    endif
    </pre>


    For the life of me (not worth much, I know) I can't see how to determine the type.


    (on a philosophical note, I also can't work out why VBE should care what the type is; it's a block of code, tell me the starting point and the length of it already!)

  2. #2
    Gold Lounger
    Join Date
    Dec 2000
    Location
    Hollywood (sorta), California, USA
    Posts
    2,759
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: determine the procedure type (Word97-SR2/VBE)

    You're looking more like a gray Lounger than Bronze.

    Of course, you do have a reference set to the VBA extensions? Let's start at the beginning. If not, refer to those constants by their integer equivalents or set the ref.
    Kevin <IMG SRC=http://www.wopr.com/w3tuserpics/Kevin_sig.gif alt="Keep the change, ya filthy animal...">
    <img src=/w3timages/blackline.gif width=33% height=2><img src=/w3timages/redline.gif width=33% height=2><img src=/w3timages/blackline.gif width=33% height=2>

  3. #3
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Yilgarn region of Toronto, Ontario
    Posts
    5,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: determine the procedure type (Word97-SR2/VBE)

    > You do have a reference set to the VBA extensions?

    Yes. I would expect the code to behave in a like manner whether I used the vbConstant identifiers or the numeric literal value.

    There seems to be no Property (or Method) in a CodeModule or CodePan or anything nearby that lets me determine what type of procedure I am in.

    It's a catch-22, as far as I can see.



    >You're looking more like a gray Lounger than Bronze

    Try "Hazel"!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •