XL 2010 Ouverture application très longue

herve62

XLDnaute Barbatruc
Supporter XLD
Bonjour
N'y aurait-il pas une autre méthode d'ouverture de fichiers ?
Ici il faut 20 secs à la 1ere selection mais au moins 25 sur le 2eme choix !!
Cette Sub doit aussi servir à ouvrir des MP4 et des JPEG c'est pour cette raison que j'avais choisi cette méthode
 

Pièces jointes

  • elec.zip
    650.4 KB · Affichages: 19

patricktoulon

XLDnaute Barbatruc
bonjour @hervé62
déjà je ré écris ta fillcombo comme ceci
VB:
Sub fillcombo()
Dim nom_proj(), chemin$, direction, nbfic&, L&

chemin = ThisWorkbook.Path & "\ficpdf\"
direction = Dir(chemin & "*.pdf")

While direction <> ""
nbfic = nbfic + 1: ReDim Preserve nom_proj(1 To nbfic): nom_proj(nbfic) = Split(direction, ".")(0)
direction = Dir()
Wend
'==============================
col = "A": L = 2
With Sheets("Listes")
.Range(.Cells(L, col), .Cells(Rows.Count, col).End(xlUp)).ClearContents
.Cells(L, col).Resize(UBound(nom_proj, 1)) = Application.Transpose(nom_proj)
end with
'==============================

tri_nom (col)
End Sub
 
Dernière édition:

patricktoulon

XLDnaute Barbatruc
re
et pour le tri etant donné que l'on est sur un array (1dim) ben on travaille pas sur feuille jusqu ’ à transpoition

VB:
Sub fillcombo()
    Dim nom_proj(), chemin$, direction, nbfic&, L&

    chemin = ThisWorkbook.Path & "\ficpdf\"
    direction = Dir(chemin & "*.pdf")

    While direction <> ""
        nbfic = nbfic + 1: ReDim Preserve nom_proj(1 To nbfic): nom_proj(nbfic) = Split(direction, ".")(0)
        direction = Dir()
    Wend
    '==============================
    col = "A": L = 2
    With Sheets("Listes")
        .Range(.Cells(L, col), .Cells(Rows.Count, col).End(xlUp)).ClearContents
        .Cells(L, col).Resize(UBound(nom_proj, 1)) = Application.Transpose(tri_nom(nom_proj))
    end with
    '==============================

End Sub
Function tri_nom(T)
    Dim temp$, I&, I2&
    For I = UBound(T) To LBound(T) Step -1
        For I2 = UBound(T) To LBound(T) Step -1
            If T(I) > T(I2) Then temp = T(I2): T(I2) = T(I): T(I) = temp
        Next
    Next
    tri_nom = T
End Function
 
Dernière édition:

Discussions similaires