sorting the layer

Discussion in 'AutoCAD' started by Guest, Sep 9, 2004.

  1. Guest

    Guest Guest

    how the code for sorting the layer
    ====================
    Private Sub UserForm_Initialize()
    Dim LayerName As String
    Dim Alayer As AcadLayer
    For Each Alayer In ThisDrawing.Layers
    LayerName = Alayer.Name
    ListBox1.AddItem (LayerName)
    Next

    End Sub
     
    Guest, Sep 9, 2004
    #1
  2. Guest

    user0 Guest

    If you were using VB you could set the Sorted property of your ListBox to True and that would do it. If you're using VBA you could create an ADO recordset, dump all your layer names into it then sort it. See the attached text file for an example. The sample uses a Combobox though.

    Rick
     
    user0, Sep 9, 2004
    #2
  3. Guest

    user0 Guest

    Also,
    You'll need to reference Microsoft ActiveX Data Objects in your VBA References for the ADO code to work.
     
    user0, Sep 9, 2004
    #3
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.