Vba object's property as argument to a function

Discussion in 'AutoCAD' started by herve, Feb 19, 2004.

  1. herve

    herve Guest

    Hello
    I try to send object property as argument to a function in vba
    this function must sort objects by "LAYER" or "COLOR"
    but i don't know how to use this argument in the function

    Public Function tri_par ( Aray , value)
    For i = 1 To UBound (aray)
    ..............
    ..........
    objprop = objent.value (where value is equal to "LAYER" or "COLOR")
    doesn't seems to be right

    if it isn't possible, Is there a command that accept dxf code as argument ?
    That irritates me, if I succeeded not, I go back in Lisp ;)

    Thank for help me.
     
    herve, Feb 19, 2004
    #1
  2. herve

    Jeff Mishler Guest

    I'm not sure what you are asking.....if you could post the lisp code that
    does what you want, I/we can help you get the VB code to do the same thing.

    Jeff
     
    Jeff Mishler, Feb 19, 2004
    #2
  3. herve

    herve Guest

    My question is :
    Can i have a variable to define a property
    like in visual lisp
    (setq dummy "layer")
    (vlax-get-property object dummy)
    in vba
    dummy = "layer"
    object.dummy
    is incorrect
    is there a method in vba to do this ?
    sorry, I explained with difficulty because my English is poor
     
    herve, Feb 23, 2004
    #3
  4. Perhaps this is what you are after?

    (setq dummy "layer")
    (vlax-get-property object (read dummy))
     
    Jason Piercey, Feb 24, 2004
    #4
  5. herve

    Jeff Mishler Guest

    OK, I think I've got what you are attempting. Try this:

    For i = 1 To UBound(Aray)
    ..............
    ..........
    Select Case value
    Case "LAYER"
    objprop = objEnt.Layer

    Case "COLOR"
    objprop = objEnt.Color

    End Select

    HTH,
    Jeff
     
    Jeff Mishler, Feb 24, 2004
    #5
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 (here). After that, you can post your question and our members will help you out.