VBA - actualisation d'image dans un userform
Fermé
antoshf1
-
14 mai 2009 à 11:16
Bidouilleu_R Messages postés 1181 Date d'inscription mardi 27 mai 2008 Statut Membre Dernière intervention 12 juillet 2012 - 14 mai 2009 à 18:34
Bidouilleu_R Messages postés 1181 Date d'inscription mardi 27 mai 2008 Statut Membre Dernière intervention 12 juillet 2012 - 14 mai 2009 à 18:34
A voir également:
- VBA - actualisation d'image dans un userform
- Image iso - Guide
- Acronis true image - Télécharger - Sauvegarde
- Image iso windows 10 - Guide
- Insérer une image dans word sans bouger le texte - Guide
- Faststone image viewer - Télécharger - Visionnage & Diaporama
3 réponses
Bidouilleu_R
Messages postés
1181
Date d'inscription
mardi 27 mai 2008
Statut
Membre
Dernière intervention
12 juillet 2012
295
14 mai 2009 à 13:49
14 mai 2009 à 13:49
Bonjour,
j'ai fait un programme qui donne ça : à partir d'un userform
Private Sub BoutonPrecedent_Click()
If ChartNum = 1 Then
ChartNum = 5
Else
ChartNum = ChartNum - 1
UpdateChart
End If
If ChartNum Mod 2 = 0 Then
ImageName2 = ThisWorkbook.Path & Application.PathSeparator & "logo_1-mini.bmp"
' l'image Temp ou logo se trouve au même endroit que le fichier (serveur ou en local)
Image2.Picture = LoadPicture(ImageName2)
Image2.ControlTipText = "Visualisation Graphique"
Else
Image2.Picture = LoadPicture(ImageName2)
Image2.ControlTipText = "Réalisation : : )"
End If
DoEvents
End Sub
Private Sub BoutonSuivant_Click()
If ChartNum = 5 Then
ChartNum = 1
Else
ChartNum = ChartNum + 1
UpdateChart
End If
If (ChartNum Mod 2) = 0 Then
ImageName2 = ThisWorkbook.Path & Application.PathSeparator & "logo1-mini.bmp"
' l'image se trouve au même endroit que le fichier
Image2.Picture = LoadPicture(ImageName2)
Image2.ControlTipText = "Visualisation Graphique"
Else
ImageName2 = ThisWorkbook.Path & Application.PathSeparator & "LogoRmini.bmp"
Image2.Picture = LoadPicture(ImageName2)
Image2.ControlTipText = "Réalisation : )"
End If
DoEvents
End Sub
Private Sub UpdateChart()
Set CurrentChart = Sheets("Evolution").ChartObjects(ChartNum).Chart
CurrentChart.Parent.Width = 480 ' taille x
CurrentChart.Parent.Height = 300 ' taille y
' Sauve le graphique en format GIF
Fname = ThisWorkbook.Path & Application.PathSeparator & "temp.gif"
CurrentChart.Export Filename:=Fname, FilterName:="GIF"
' Affiche le graphique
Image1.Picture = LoadPicture(Fname)
End Sub
C'est la dernière partie qui t'interesse predent et suivant te dise comment l'utiliser.
bon travail
A+
R
j'ai fait un programme qui donne ça : à partir d'un userform
Private Sub BoutonPrecedent_Click()
If ChartNum = 1 Then
ChartNum = 5
Else
ChartNum = ChartNum - 1
UpdateChart
End If
If ChartNum Mod 2 = 0 Then
ImageName2 = ThisWorkbook.Path & Application.PathSeparator & "logo_1-mini.bmp"
' l'image Temp ou logo se trouve au même endroit que le fichier (serveur ou en local)
Image2.Picture = LoadPicture(ImageName2)
Image2.ControlTipText = "Visualisation Graphique"
Else
Image2.Picture = LoadPicture(ImageName2)
Image2.ControlTipText = "Réalisation : : )"
End If
DoEvents
End Sub
Private Sub BoutonSuivant_Click()
If ChartNum = 5 Then
ChartNum = 1
Else
ChartNum = ChartNum + 1
UpdateChart
End If
If (ChartNum Mod 2) = 0 Then
ImageName2 = ThisWorkbook.Path & Application.PathSeparator & "logo1-mini.bmp"
' l'image se trouve au même endroit que le fichier
Image2.Picture = LoadPicture(ImageName2)
Image2.ControlTipText = "Visualisation Graphique"
Else
ImageName2 = ThisWorkbook.Path & Application.PathSeparator & "LogoRmini.bmp"
Image2.Picture = LoadPicture(ImageName2)
Image2.ControlTipText = "Réalisation : )"
End If
DoEvents
End Sub
Private Sub UpdateChart()
Set CurrentChart = Sheets("Evolution").ChartObjects(ChartNum).Chart
CurrentChart.Parent.Width = 480 ' taille x
CurrentChart.Parent.Height = 300 ' taille y
' Sauve le graphique en format GIF
Fname = ThisWorkbook.Path & Application.PathSeparator & "temp.gif"
CurrentChart.Export Filename:=Fname, FilterName:="GIF"
' Affiche le graphique
Image1.Picture = LoadPicture(Fname)
End Sub
C'est la dernière partie qui t'interesse predent et suivant te dise comment l'utiliser.
bon travail
A+
R
Merci beaucoup pour votre réponse !
Voilà j'ai donc copié ça dans mon nouveau userform ds leqiel je veux mettre mon graphique :
Private Sub UpdateChart()
Set CurrentChart = Sheets("P&L_BTFL_1S").ChartObjects(ChartNum).Chart
CurrentChart.Parent.Width = 480 ' taille x
CurrentChart.Parent.Height = 300 ' taille y
' Sauve le graphique en format GIF
Fname = ThisWorkbook.Path & Application.PathSeparator & "temp.gif"
CurrentChart.Export Filename:=Fname, FilterName:="GIF"
' Affiche le graphique
Image1.Picture = LoadPicture(Fname)
End Sub
Et je ne sais pas quoi mettre dans ChartObjects(ChartNum).Chart, sachant que mon graphique (qd je clique dessus) s'appelle apparement "Graphique 1".
Savez vous ce que je dois modifier ?
Encore merci
Voilà j'ai donc copié ça dans mon nouveau userform ds leqiel je veux mettre mon graphique :
Private Sub UpdateChart()
Set CurrentChart = Sheets("P&L_BTFL_1S").ChartObjects(ChartNum).Chart
CurrentChart.Parent.Width = 480 ' taille x
CurrentChart.Parent.Height = 300 ' taille y
' Sauve le graphique en format GIF
Fname = ThisWorkbook.Path & Application.PathSeparator & "temp.gif"
CurrentChart.Export Filename:=Fname, FilterName:="GIF"
' Affiche le graphique
Image1.Picture = LoadPicture(Fname)
End Sub
Et je ne sais pas quoi mettre dans ChartObjects(ChartNum).Chart, sachant que mon graphique (qd je clique dessus) s'appelle apparement "Graphique 1".
Savez vous ce que je dois modifier ?
Encore merci
Bidouilleu_R
Messages postés
1181
Date d'inscription
mardi 27 mai 2008
Statut
Membre
Dernière intervention
12 juillet 2012
295
14 mai 2009 à 18:34
14 mai 2009 à 18:34
Set CurrentChart = Sheets("P&L_BTFL_1S").ChartObjects(ChartNum).Chart
chartnum contient le numero d'index de chaque graphique.
si tu en qu'un tu mets 1
moi j'en avais 5.
c'est pourquoi dans les modules boutonsuivant_click
on trouve
If ChartNum = 5 Then
ChartNum = 1
else....
Set CurrentChart = Sheets("P&L_BTFL_1S").ChartObjects(ChartNum).Chart
'cette ligne définit l'objet
Set CurrentChart = Sheets("Evolution").ChartObjects(ChartNum).Chart
CurrentChart.Parent.Width = 480 ' taille x
CurrentChart.Parent.Height = 300 ' taille y
' Sauve le graphique en format GIF Chemin + nom
Fname = ThisWorkbook.Path & Application.PathSeparator & "temp.gif"
'Procedure d'export
CurrentChart.Export Filename:=Fname, FilterName:="GIF"
' Affiche le graphique
Image1.Picture = LoadPicture(Fname)
chartnum contient le numero d'index de chaque graphique.
si tu en qu'un tu mets 1
moi j'en avais 5.
c'est pourquoi dans les modules boutonsuivant_click
on trouve
If ChartNum = 5 Then
ChartNum = 1
else....
Set CurrentChart = Sheets("P&L_BTFL_1S").ChartObjects(ChartNum).Chart
'cette ligne définit l'objet
Set CurrentChart = Sheets("Evolution").ChartObjects(ChartNum).Chart
CurrentChart.Parent.Width = 480 ' taille x
CurrentChart.Parent.Height = 300 ' taille y
' Sauve le graphique en format GIF Chemin + nom
Fname = ThisWorkbook.Path & Application.PathSeparator & "temp.gif"
'Procedure d'export
CurrentChart.Export Filename:=Fname, FilterName:="GIF"
' Affiche le graphique
Image1.Picture = LoadPicture(Fname)