• Initiateur de la discussion Initiateur de la discussion Hulk
  • Date de début Date de début

Boostez vos compétences Excel avec notre communauté !

Rejoignez Excel Downloads, le rendez-vous des passionnés où l'entraide fait la force. Apprenez, échangez, progressez – et tout ça gratuitement ! 👉 Inscrivez-vous maintenant !

Hulk

XLDnaute Barbatruc
Hello les amis,

Encore un souci.

Je souhaite utiliser le Path pour lui dire que des images demandées pour un graphique se trouvent dans le même dossier que le fichier.

J'espère que je suis clair dans ma demande.

J'ai joins un petit fichier.

Merci pour votre aide.

Hulk.
 

Pièces jointes

Re : Path

Bonour à tous,
Salut Doc Banner,

Ton code un peu raccourci et avec la proposition de Catrice :

Code:
Sub Graphique()
Application.ScreenUpdating = False

    Charts.Add
    ActiveChart.SetSourceData Source:=Sheets("Feuil1").Range("A1:C3"), PlotBy:=xlColumns
    ActiveChart.Location Where:=xlLocationAsObject, Name:="Feuil1"
    With ActiveChart
     .HasLegend = False
     .ChartType = xlColumnClustered
      x = Right(.Name, Len(.Name) - 6)
      .HasAxis(xlCategory, xlPrimary) = False
      .SeriesCollection(1).Select
      .Pictures.Insert (ThisWorkbook.Path & "\Hulk1.jpg")
      .SeriesCollection(2).Select
      .Pictures.Insert (ThisWorkbook.Path & "\Hulk2.jpg")
      .HasAxis(xlCategory, xlPrimary) = True
      .Axes(xlCategory, xlPrimary).CategoryType = xlAutomatic
      .PlotArea.ClearFormats
    End With
    ActiveSheet.Shapes(x).IncrementLeft 1.5
    ActiveSheet.Shapes(x).IncrementTop -85.5
Range("A1").Select
Application.ScreenUpdating = True
End Sub

A++
A+ à tous
 
Re : Path

Hello le Forum, Catrice, ami JC,

Merci Catrice c'est impec et tout bête 😱

JC comme toujours tu nettoyes, je vais finir par te surnommer Léon 😀

Trève de plaisanterie merci pour le ménage, effectivement c'est bien mieux comme ça.

Bravo et thanks aux deux !

Buenas noche !

Papa Noel Hulk 😀
 
Re : Path

Bonsoir Hulk, JCGL,

Juste pour le Fun,en core un peu raccourci , le code suivant a l'air de faire la meme chose :

Sub Graphique()
Application.ScreenUpdating = False
Charts.Add
ActiveChart.SetSourceData Source:=Sheets("Feuil1").Range("A1:C3"), PlotBy:=xlColumns
ActiveChart.Location Where:=xlLocationAsObject, Name:="Feuil1"
With ActiveChart
.HasLegend = False
.ChartType = xlColumnClustered
.SeriesCollection(1).Fill.UserPicture ThisWorkbook.Path & "\Hulk1.jpg"
.SeriesCollection(2).Fill.UserPicture ThisWorkbook.Path & "\Hulk2.jpg"
.PlotArea.ClearFormats
End With
Range("A1").Select
Application.ScreenUpdating = True
End Sub
 
Re : Path

Bonsoir Hulk, JCGL,

Juste pour le Fun, le code suivant a l'air de faire la meme chose :

Sub Graphique()
Application.ScreenUpdating = False
Charts.Add
ActiveChart.SetSourceData Source:=Sheets("Feuil1").Range("A1:C3"), PlotBy:=xlColumns
ActiveChart.Location Where:=xlLocationAsObject, Name:="Feuil1"
With ActiveChart
.HasLegend = False
.SeriesCollection(1).Fill.UserPicture ThisWorkbook.Path & "\Hulk1.jpg"
.SeriesCollection(2).Fill.UserPicture ThisWorkbook.Path & "\Hulk2.jpg"
.PlotArea.ClearFormats
End With
Range("A1").Select
Application.ScreenUpdating = True
End Sub
 
Re : Path

Hello le Forum, Catrice,

Encore plus court !

Mais si pour l'emplacement je rajoute juste les lignes:

Code:
Sub Graphique()
Application.ScreenUpdating = False
Charts.Add
ActiveChart.SetSourceData Source:=Sheets("Feuil1").Range("A1:C3"), PlotBy:=xlColumns
ActiveChart.Location Where:=xlLocationAsObject, Name:="Feuil1"
x = Right(.Name, Len(.Name) - 6) [COLOR="Green"][B]'ici[/B][/COLOR]
With ActiveChart
.HasLegend = False
.SeriesCollection(1).Fill.UserPicture ThisWorkbook.Path & "\Hulk1.jpg"
.SeriesCollection(2).Fill.UserPicture ThisWorkbook.Path & "\Hulk2.jpg"
.PlotArea.ClearFormats
End With
ActiveSheet.Shapes(x).IncrementLeft 1.5 [COLOR="green"][B]'ici[/B][/COLOR]
ActiveSheet.Shapes(x).IncrementTop -85.5 [COLOR="green"][B]'et ici[/B][/COLOR]
Range("A1").Select
Application.ScreenUpdating = True
End Sub

Il y a erreur ? Tu as une idée ?

Merci, Hulk.
 
- Navigue sans publicité
- Accède à Cléa, notre assistante IA experte Excel... et pas que...
- Profite de fonctionnalités exclusives
Ton soutien permet à Excel Downloads de rester 100% gratuit et de continuer à rassembler les passionnés d'Excel.
Je deviens Supporter XLD

Discussions similaires

Réponses
5
Affichages
317
  • Question Question
Microsoft 365 Format de nombres
Réponses
21
Affichages
521
Réponses
7
Affichages
283
  • Question Question
Microsoft 365 bouton supprimer
Réponses
4
Affichages
228
Retour