Précédent   Forum des professionnels en informatique > Logiciels > Microsoft Office > Excel > Macros et VBA Excel
Macros et VBA Excel Vos questions relatives aux macros Excel, à l'utilisation de VBA et à l'automatisation de vos classeurs Excel.
Partagez cette discussion sur d'autres réseaux sociaux : Viadeo Twitter Google Facebook Digg Delicious MySpace Yahoo
Réponse Proposer ce sujet en actualité
 
Outils de la discussion
Publicité
'
Vieux 07/10/2011, 19h26   #1
Nouveau Membre du Club
 
Homme tof tim
Technicien maintenance
Inscription : septembre 2011
Messages : 101
Détails du profil
Informations personnelles :
Nom : Homme tof tim
Localisation : Belgique

Informations professionnelles :
Activité : Technicien maintenance
Secteur : Bâtiment Travaux Publics

Informations forums :
Inscription : septembre 2011
Messages : 101
Points : 39
Points : 39
Par défaut boutons pour afficher images

bonjour tout lemonde,

j'essaye à partir d'un userForm et de deux boutons d'afficher une serie d'image dans un image1

commandBouton1 = avance
commandBouton2 = recule

image1

j'ai par exemple 3 images dans mon repertoire c:\mes photos
je souhaiterai en cliquant sur le boutons avancer les faire défiler en avant et l'inverse sur le bouton reculer...

Voilà merci pour votre aide et un bon week end à tous
Tim.
timtof2011 est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 07/10/2011, 21h42   #2
Expert Confirmé Sénior
 
Avatar de mercatog
 
Inscription : juillet 2008
Messages : 5 848
Détails du profil
Informations forums :
Inscription : juillet 2008
Messages : 5 848
Points : 13 907
Points : 13 907
Bonsoir
A adapter
Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
Option Explicit
Dim Tb() As String
Dim Indx As Integer
 
Private Sub UserForm_Initialize()
Dim Chemin As String, FichImg As String
Dim i As Integer
 
Chemin = "C:\Users\user\Pictures\"
FichImg = Dir(Chemin & "*.jpg")
Do While FichImg <> ""
    i = i + 1
    ReDim Preserve Tb(1 To i)
    Tb(i) = Chemin & FichImg
    FichImg = Dir()
Loop
If UBound(Tb) >= 1 Then
    Me.Image1.Picture = LoadPicture(Tb(1))
    Indx = 1
End If
End Sub
 
Private Sub CommandButton1_Click()
 
If UBound(Tb) >= 1 Then
    Indx = IIf(Indx = UBound(Tb), 1, Indx + 1)
    Me.Image1.Picture = LoadPicture(Tb(Indx))
End If
End Sub
 
Private Sub CommandButton2_Click()
 
If UBound(Tb) >= 1 Then
    Indx = IIf(Indx = 1, UBound(Tb), Indx - 1)
    Me.Image1.Picture = LoadPicture(Tb(Indx))
End If
End Sub
__________________
Cordialement.
mercatog est déconnecté   Envoyer un message privé Réponse avec citation 10
Vieux 07/10/2011, 21h47   #3
Nouveau Membre du Club
 
Homme tof tim
Technicien maintenance
Inscription : septembre 2011
Messages : 101
Détails du profil
Informations personnelles :
Nom : Homme tof tim
Localisation : Belgique

Informations professionnelles :
Activité : Technicien maintenance
Secteur : Bâtiment Travaux Publics

Informations forums :
Inscription : septembre 2011
Messages : 101
Points : 39
Points : 39
Merci beaucoup Mercatog pour ce code...ça marche...depuis 16h je cherchais...

bien à vous.

Tim
timtof2011 est déconnecté   Envoyer un message privé Réponse avec citation 00
Réponse Proposer ce sujet en actualité Cette discussion est résolue.
Outils de la discussion



Fuseau horaire GMT +2. Il est actuellement 19h35.


 
 
 
 
Partenaires

Hébergement Web