Boucle et ShellExecute

Résolu
cs_JeffC1977 Messages postés 928 Date d'inscription vendredi 10 novembre 2000 Statut Membre Dernière intervention 23 septembre 2023 - 12 août 2005 à 19:54
Gobillot Messages postés 3140 Date d'inscription vendredi 14 mai 2004 Statut Membre Dernière intervention 11 mars 2019 - 12 août 2005 à 20:37
Salut...

Bon je suis vraiment nulle avec les boucles j'en utilise jamais mais là, j'ai pas le choix...

J'utilise VB6

Je veux ouvrir un fichier (TIF) à partir d'un textbox.
Cependant il se peut que le numéro entrer dans le textbox égal pas un un image TIF. Donc il faut que je diminue la valeur du textbox de 1 et de vérifier si le TIF existe jusqu'à ce que le TIF existe...

Ce que je ne comrpend pas c'est qu'un fois que mon textbox a le bon numéro ma variable Kilkenny est toujours = à 2. Avec un ShellExecute, la valeur (si le fichier existe) devrait être supérieur à 32 NON ?????

Est ce que j eme trompe....


J'Attends votre aide

Merci d'avance

Voici mon code

Dim Kilkenny As Variant
Kilkenny = ShellExecute(Me.hWnd, "open", "m:\Recherches_BPD\SCAN_061700" & txtFolio & ".tif", vbNullString, "", SW_SHOWNORMAL)

If Kilkenny <= 32 Then
strRechercheFolio = txtFolio
Do Until Kilkenny > 32
strRechercheFolio = strRechercheFolio - 1
txtFolio.Text = strRechercheFolio
Kilkenny = ShellExecute(Me.hWnd, "open", "m:\Recherches_BPD\SCAN_061700" & txtFolio & ".tif", vbNullString, "", SW_SHOWNORMAL)
Loop
End If

1 réponse

Gobillot Messages postés 3140 Date d'inscription vendredi 14 mai 2004 Statut Membre Dernière intervention 11 mars 2019 34
12 août 2005 à 20:37
ShellExecute:

<>





Dim Path As String

Dim Fichier As String



Path = "M:\Recherches_BPD\SCAN_061700"



For strRechercheFolio = 100 To 1 Step -1

txtFolio.Text = strRechercheFolio

Fichier = Path & strRechercheFolio & ".tif"

If Dir(Fichier) <> "" Then Exit For

Next

if i > 0 then

ShellExecute(Me.hWnd, "open", Fichier, vbNullString, "", SW_SHOWNORMAL)

Else

MsgBox "Le Fichier est absent"

end if


Daniel
3
Rejoignez-nous