ListBox ordonare alfabetica

Informatii despre cum se utilizeaza Microsoft Word 2003. Editare, formatare, automatizare de documente
Închis
ccirtina
Mesaje: 280
Membru din: Lun Oct 11, 2010 9:49 pm
Localitate: Craiova

ListBox ordonare alfabetica

Mesaj de ccirtina » Sâm Dec 24, 2016 7:00 pm

Word 2003
Cum ordonez alfabetic printr-o apasare de buton CommandButton1_Click() ?

Private Sub UserForm_Initialize()

'Creates and assigns the Array to the ListBox when the form loads.
Dim mylist As Variant

mylist = Array("Sunday", "Monday", "Tuesday", "Wednesday", _
"Thursday", "Friday", "Saturday")
ListBox1.List = mylist

End Sub

Multumesc

ccirtina
Mesaje: 280
Membru din: Lun Oct 11, 2010 9:49 pm
Localitate: Craiova

Re: ListBox ordonare alfabetica

Mesaj de ccirtina » Dum Dec 25, 2016 9:42 am

am gasit urmatoarea varianta:

Private Sub CommandButton3_Click()
Dim lZeile As Long ' For/Next Zeilen-Index
Dim lIndxA As Long ' For/Next Index - außen
Dim lIndxI As Long ' For/next Index - innen
Dim sTemp As String ' temporärer Zwischenspeicher
For lIndxA = 0 To Me.ListBox1.ListCount - 1
For lIndxI = 0 To lIndxA - 1
If UCase(ListBox1.List(lIndxI)) > UCase(ListBox1.List(lIndxA)) Then
sTemp = ListBox1.List(lIndxI)
ListBox1.List(lIndxI) = ListBox1.List(lIndxA)
ListBox1.List(lIndxA) = sTemp
End If
Next lIndxI
Next lIndxA
End Sub

Închis

Înapoi la “Intrebari despre Word 2003”