Conversion de macro excel 2007 en macro 2003
Fermé
bill_test
-
3 sept. 2009 à 15:46
Le Pingou Messages postés 12242 Date d'inscription mercredi 11 août 2004 Statut Contributeur Dernière intervention 16 mars 2025 - 4 sept. 2009 à 17:12
Le Pingou Messages postés 12242 Date d'inscription mercredi 11 août 2004 Statut Contributeur Dernière intervention 16 mars 2025 - 4 sept. 2009 à 17:12
A voir également:
- Conversion de macro excel 2007 en macro 2003
- Telecharger macro convertir chiffre en lettre excel - Télécharger - Tableur
- Liste déroulante excel - Guide
- Save as pdf office 2007 - Télécharger - Bureautique
- Mise en forme conditionnelle excel - Guide
- Word et excel gratuit - Guide
5 réponses
J'ai apporté quelques éléments de correction de la macro, ci-dessous la version qui marche sous Excel 2007:
Sub attach()
Workbooks.Open Filename:= _
"C:\Subs.xls"
Sheets.Add
ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:= _
"Report!r1C1:r8000C3", Version:=xlPivotTableVersion10).CreatePivotTable _
TableDestination:="Feuil1!r3C1", TableName:="Tableau croisé dynamique23", _
DefaultVersion:=xlPivotTableVersion10
Sheets("Feuil1").Select
Cells(3, 1).Select
With ActiveSheet.PivotTables("Tableau croisé dynamique23").PivotFields( _
"work")
.Orientation = xlColumnField
.Position = 1
End With
With ActiveSheet.PivotTables("Tableau croisé dynamique23").PivotFields("Time")
.Orientation = xlRowField
.Position = 1
End With
With ActiveSheet.PivotTables("Tableau croisé dynamique23").PivotFields("Time")
.PivotItems("(vide)").Visible = False
End With
ActiveSheet.PivotTables("Tableau croisé dynamique23").AddDataField ActiveSheet. _
PivotTables("Tableau croisé dynamique23").PivotFields( _
"User"), "Somme de User", xlSum
Range("A176").Select
ActiveCell.FormulaR1C1 = "peak"
Windows("Subs.xls").Activate
Range("A177").Select
ActiveCell.FormulaR1C1 = "=MAX(R[-172]C[21]:R[-5]C[21])"
Range("A177").Select
Selection.Copy
Windows("Rapport.xls").Activate
Sheets("test").Select
Range("I20").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Windows("Subs.xls").Activate
Range("H3").Select
Application.CutCopyMode = False
ActiveSheet.Shapes.AddChart.Select
ActiveChart.SetSourceData Source:=Range("Feuil1!$A$3:$V$173")
ActiveWorkbook.ShowPivotChartActiveFields = True
ActiveChart.ApplyChartTemplate ("C:\text.crtx")
ActiveChart.ChartArea.Copy
Windows("Rapport.xls").Activate
Range("A6").Select
ActiveSheet.Paste
Windows("Subs.xls").Activate
ActiveWorkbook.Save
ActiveWindow.Close
End Sub
Il affiche le message suivant au niveau de ActiveChart.ApplyChartTemplate ("C:\text.crtx")
Erreur de compilation:
Membre de méthode ou de données introuvable
Merci pour votre aide.
Sub attach()
Workbooks.Open Filename:= _
"C:\Subs.xls"
Sheets.Add
ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:= _
"Report!r1C1:r8000C3", Version:=xlPivotTableVersion10).CreatePivotTable _
TableDestination:="Feuil1!r3C1", TableName:="Tableau croisé dynamique23", _
DefaultVersion:=xlPivotTableVersion10
Sheets("Feuil1").Select
Cells(3, 1).Select
With ActiveSheet.PivotTables("Tableau croisé dynamique23").PivotFields( _
"work")
.Orientation = xlColumnField
.Position = 1
End With
With ActiveSheet.PivotTables("Tableau croisé dynamique23").PivotFields("Time")
.Orientation = xlRowField
.Position = 1
End With
With ActiveSheet.PivotTables("Tableau croisé dynamique23").PivotFields("Time")
.PivotItems("(vide)").Visible = False
End With
ActiveSheet.PivotTables("Tableau croisé dynamique23").AddDataField ActiveSheet. _
PivotTables("Tableau croisé dynamique23").PivotFields( _
"User"), "Somme de User", xlSum
Range("A176").Select
ActiveCell.FormulaR1C1 = "peak"
Windows("Subs.xls").Activate
Range("A177").Select
ActiveCell.FormulaR1C1 = "=MAX(R[-172]C[21]:R[-5]C[21])"
Range("A177").Select
Selection.Copy
Windows("Rapport.xls").Activate
Sheets("test").Select
Range("I20").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Windows("Subs.xls").Activate
Range("H3").Select
Application.CutCopyMode = False
ActiveSheet.Shapes.AddChart.Select
ActiveChart.SetSourceData Source:=Range("Feuil1!$A$3:$V$173")
ActiveWorkbook.ShowPivotChartActiveFields = True
ActiveChart.ApplyChartTemplate ("C:\text.crtx")
ActiveChart.ChartArea.Copy
Windows("Rapport.xls").Activate
Range("A6").Select
ActiveSheet.Paste
Windows("Subs.xls").Activate
ActiveWorkbook.Save
ActiveWindow.Close
End Sub
Il affiche le message suivant au niveau de ActiveChart.ApplyChartTemplate ("C:\text.crtx")
Erreur de compilation:
Membre de méthode ou de données introuvable
Merci pour votre aide.
Le Pingou
Messages postés
12242
Date d'inscription
mercredi 11 août 2004
Statut
Contributeur
Dernière intervention
16 mars 2025
1 458
4 sept. 2009 à 15:47
4 sept. 2009 à 15:47
Bonjour,
Cette méthode ( ApplyChartTemplate) applique un type de graphique standard ou personnalisé à un graphique n'est pas prise en compte par Excel 2003.
Essayez de neutraliser la ligne et voir si la procédure fonctionne!
Cette méthode ( ApplyChartTemplate) applique un type de graphique standard ou personnalisé à un graphique n'est pas prise en compte par Excel 2003.
Essayez de neutraliser la ligne et voir si la procédure fonctionne!
Le Pingou
Messages postés
12242
Date d'inscription
mercredi 11 août 2004
Statut
Contributeur
Dernière intervention
16 mars 2025
1 458
4 sept. 2009 à 17:12
4 sept. 2009 à 17:12
Bonjour,
J’ai mis le doigt sur un article qui devrait vous aider. https://excel.developpez.com/faq/?page=Graphique#ModeleGraph2007 , voir [ Nota
Méthode pour Excel 2002] vers la fin.
J’ai réalisé un essai en créant un graphique que j’ai enregistré sous « mongraphique » et voici la ligne de code que j’ai récupéré:
ActiveChart.ApplyCustomType ChartType:=xlUserDefined, TypeName:= "mongraphique"
"
J’ai mis le doigt sur un article qui devrait vous aider. https://excel.developpez.com/faq/?page=Graphique#ModeleGraph2007 , voir [ Nota
Méthode pour Excel 2002] vers la fin.
J’ai réalisé un essai en créant un graphique que j’ai enregistré sous « mongraphique » et voici la ligne de code que j’ai récupéré:
ActiveChart.ApplyCustomType ChartType:=xlUserDefined, TypeName:= "mongraphique"
"
Le Pingou
Messages postés
12242
Date d'inscription
mercredi 11 août 2004
Statut
Contributeur
Dernière intervention
16 mars 2025
1 458
3 sept. 2009 à 23:21
3 sept. 2009 à 23:21
Bonjour,
Qu'elle est le message d'erreur sur 2003 et la ligne concernée !
Qu'elle est le message d'erreur sur 2003 et la ligne concernée !
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question
J'ai apporté quelques éléments de correction de la macro, ci-dessous la version qui marche sous Excel 2007:
Sub attach()
Workbooks.Open Filename:= _
"C:\Subs.xls"
Sheets.Add
ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:= _
"Report!r1C1:r8000C3", Version:=xlPivotTableVersion10).CreatePivotTable _
TableDestination:="Feuil1!r3C1", TableName:="Tableau croisé dynamique23", _
DefaultVersion:=xlPivotTableVersion10
Sheets("Feuil1").Select
Cells(3, 1).Select
With ActiveSheet.PivotTables("Tableau croisé dynamique23").PivotFields( _
"work")
.Orientation = xlColumnField
.Position = 1
End With
With ActiveSheet.PivotTables("Tableau croisé dynamique23").PivotFields("Time")
.Orientation = xlRowField
.Position = 1
End With
With ActiveSheet.PivotTables("Tableau croisé dynamique23").PivotFields("Time")
.PivotItems("(vide)").Visible = False
End With
ActiveSheet.PivotTables("Tableau croisé dynamique23").AddDataField ActiveSheet. _
PivotTables("Tableau croisé dynamique23").PivotFields( _
"User"), "Somme de User", xlSum
Range("A176").Select
ActiveCell.FormulaR1C1 = "peak"
Windows("Subs.xls").Activate
Range("A177").Select
ActiveCell.FormulaR1C1 = "=MAX(R[-172]C[21]:R[-5]C[21])"
Range("A177").Select
Selection.Copy
Windows("Rapport.xls").Activate
Sheets("test").Select
Range("I20").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Windows("Subs.xls").Activate
Range("H3").Select
Application.CutCopyMode = False
ActiveSheet.Shapes.AddChart.Select
ActiveChart.SetSourceData Source:=Range("Feuil1!$A$3:$V$173")
ActiveWorkbook.ShowPivotChartActiveFields = True
ActiveChart.ApplyChartTemplate ("C:\text.crtx")
ActiveChart.ChartArea.Copy
Windows("Rapport.xls").Activate
Range("A6").Select
ActiveSheet.Paste
Windows("Subs.xls").Activate
ActiveWorkbook.Save
ActiveWindow.Close
End Sub
Il affiche le message suivant au niveau de ActiveChart.ApplyChartTemplate ("C:\text.crtx")
Erreur de compilation:
Membre de méthode ou de données introuvable
Merci pour votre aide.
Sub attach()
Workbooks.Open Filename:= _
"C:\Subs.xls"
Sheets.Add
ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:= _
"Report!r1C1:r8000C3", Version:=xlPivotTableVersion10).CreatePivotTable _
TableDestination:="Feuil1!r3C1", TableName:="Tableau croisé dynamique23", _
DefaultVersion:=xlPivotTableVersion10
Sheets("Feuil1").Select
Cells(3, 1).Select
With ActiveSheet.PivotTables("Tableau croisé dynamique23").PivotFields( _
"work")
.Orientation = xlColumnField
.Position = 1
End With
With ActiveSheet.PivotTables("Tableau croisé dynamique23").PivotFields("Time")
.Orientation = xlRowField
.Position = 1
End With
With ActiveSheet.PivotTables("Tableau croisé dynamique23").PivotFields("Time")
.PivotItems("(vide)").Visible = False
End With
ActiveSheet.PivotTables("Tableau croisé dynamique23").AddDataField ActiveSheet. _
PivotTables("Tableau croisé dynamique23").PivotFields( _
"User"), "Somme de User", xlSum
Range("A176").Select
ActiveCell.FormulaR1C1 = "peak"
Windows("Subs.xls").Activate
Range("A177").Select
ActiveCell.FormulaR1C1 = "=MAX(R[-172]C[21]:R[-5]C[21])"
Range("A177").Select
Selection.Copy
Windows("Rapport.xls").Activate
Sheets("test").Select
Range("I20").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Windows("Subs.xls").Activate
Range("H3").Select
Application.CutCopyMode = False
ActiveSheet.Shapes.AddChart.Select
ActiveChart.SetSourceData Source:=Range("Feuil1!$A$3:$V$173")
ActiveWorkbook.ShowPivotChartActiveFields = True
ActiveChart.ApplyChartTemplate ("C:\text.crtx")
ActiveChart.ChartArea.Copy
Windows("Rapport.xls").Activate
Range("A6").Select
ActiveSheet.Paste
Windows("Subs.xls").Activate
ActiveWorkbook.Save
ActiveWindow.Close
End Sub
Il affiche le message suivant au niveau de ActiveChart.ApplyChartTemplate ("C:\text.crtx")
Erreur de compilation:
Membre de méthode ou de données introuvable
Merci pour votre aide.