91ced
Messages postés20Date d'inscriptionvendredi 5 mai 2006StatutMembreDernière intervention 5 juillet 2006
-
27 juin 2006 à 14:22
91ced
Messages postés20Date d'inscriptionvendredi 5 mai 2006StatutMembreDernière intervention 5 juillet 2006
-
28 juin 2006 à 11:24
Hello,
comment empêcher les doublons dans une Listbox...?
Mon code actuel est :
Private Sub selection_Click()
Dim files
Dim i As Byte
files = Application.GetOpenFilename(, , "Sélectionner les fichiers à " _
& "imprimer", , True)
If VarType(files) = vbBoolean Then
GoTo fin
Else
GoTo suite
End If
suite:
For i = 1 To UBound(files)
ListBox1.AddItem (files(i)) 'Remplissage Listbox
Next
fin:
End Sub
Si qqu'un peut m'ajouter ce qu'il faut pour empêcher les doublons ce serait génial !!!!
91ced
Messages postés20Date d'inscriptionvendredi 5 mai 2006StatutMembreDernière intervention 5 juillet 2006 28 juin 2006 à 11:24
En fait le problème n'est pas spécialement d'imprimer, car j'ai aussi un bouton qui permet d'ouvrir le document, et si il s'agit d'un document excel ça fonctionne pas non plus. Pour les autres, Word s'ouvre auto, Explorer aussi, Acrobat Reader idem mais pas excel !
Voici ce que j'ai mis, si ça te parle :
Private Declare Function ShellExecute Lib "shell32.dll" Alias _
"ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal _
lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As _
String, ByVal nShowCmd As Long) As Long
Private Const SW_SHOWNORMAL As Long = 1
Private Sub affiche_Click()
Dim oFile As String
Dim hwnd As Long
Dim compt As Byte
If compt = 0 Then
On Error GoTo fin
oFile = ListBox1.Value
ShellExecute hwnd, "open", oFile, vbNullString, vbNullString, SW_SHOWNORMAL
End If
fin:
End Sub