Twitter iPhone pliant OnePlus 11 PS5 Disney+ Orange Livebox Windows 11

image de Excel 2010 vers PPT 2010

2 réponses
Avatar
magic-dd
Bonsoir

ne troubant pas l'enregistreur de macros sur PPT 2010, comment faire la man=
ip suivante

graph group=E9 dans excel=20

le copier , et le coller special image dans ma diapo 1 de mon PPT

mon ppt est dans D:/loic/ppt et mon xls dans D:/loic/xls

apres je travaillerai sur le positionnement de l'objet coll=E9 puis la bouc=
le pour recup=E9rer mes graph en fonction de la valeur d'une cellule

je reviendrai certainement demander de l'aide

merci

2 réponses

Avatar
MichD
Bonjour,

Voici un exemple de code créé par Stephen Bullen

Pour l'exécution de ce type de code, tu dois ajouter
les bibliothèques suivantes :
Microsoft PowerPoint xx Objects library
Microsoft Graph xx objects library

Espérons que cela peut aider ton inspiration... ;-)
'-----------------------------------------------
Sub PPTGenerateSalarySummary()

'Powerpoint objects
Dim pptApp As PowerPoint.Application
Dim pptPres As PowerPoint.Presentation
Dim pptSlide As PowerPoint.Slide
Dim pptBullets As PowerPoint.Shape

'MSGraph objects
Dim gphChart As Graph.Chart
Dim gphData As Graph.DataSheet

'Excel objects
Dim pfDiv As Excel.PivotField
Dim rngDiv As Excel.Range

'Other variables
Dim sBulletText As String
Dim lDiv As Long

On Error GoTo ErrorHandler

'Start PowerPoint
Set pptApp = CreateObject("PowerPoint.Application")

'Switch back to Excel
AppActivate Application.Caption

'Open the presentation
Set pptPres = pptApp.Presentations.Open(Filename:=ThisWorkbook.Path &
"Salary Presentation.ppt", withwindow:úlse)

'Get the 'Detail' slide
Set pptSlide = pptPres.Slides("sldDetail")

'Get the shape containing the bulleted list
Set pptBullets = pptSlide.Shapes("shpBullets")

'Get the text of the first bullet in the list
sBulletText = pptBullets.TextFrame.TextRange.Paragraphs(1).Text

'Update the text with the calculated total from the worksheet
sBulletText = Replace(sBulletText, "#SalaryTotal#",
wksData.Range("ptrSalaryTotal").Text)

'Update the presentation with the correct text
pptBullets.TextFrame.TextRange.Paragraphs(1).Text = sBulletText

'Get the MSGraph Chart object embedded in the slide
Set gphChart = pptSlide.Shapes("shpChart").OLEFormat.Object

'Get the graph's data sheet
Set gphData = gphChart.Application.DataSheet

'Get the 'Division' pivot field in the Data worksheet
Set pfDiv = wksData.PivotTables(1).PivotFields("Division")

'Loop through the range of Divisions in the pivot table
For Each rngDiv In pfDiv.DataRange
lDiv = lDiv + 1

'Write the division name and total salary to the graph data sheet
gphData.Cells(1, lDiv + 1).Value = rngDiv.Text
gphData.Cells(2, lDiv + 1).Value = rngDiv.Offset(0, 1).Value
Next rngDiv

'Apply the datasheet changes
gphChart.Application.Update

'Redraw the chart object
gphChart.Refresh

'Save the presentation with a new name
pptPres.SaveAs ThisWorkbook.Path & "Salaries 2003.ppt"

'Tidy up object variables
Set pptSlide = Nothing
Set pptBullets = Nothing
Set gphChart = Nothing
Set gphData = Nothing

'Close the presentation
pptPres.Close
Set pptPres = Nothing

'Close PowerPoint
pptApp.Quit
Set pptApp = Nothing

'Display confirmation message
MsgBox "Salary Summary Presentation Generated OK."

Exit Sub

ErrorHandler:

'Display the error number and error description
' and note the routine in the title bar
MsgBox "Error " & Err.Number & vbLf & Err.Description, _
vbCritical, "Routine: PPTGenerateSalarySummary"

End Sub
'-----------------------------------------------


MichD
---------------------------------------------------------------
Avatar
magic-dd
Merci MichD

je vais parfaire mon anglais et essayer ce truc

j'en transpire deja

:)


Le jeudi 14 février 2013 19:05:51 UTC+1, magic-dd a écrit :
Bonsoir



ne troubant pas l'enregistreur de macros sur PPT 2010, comment faire la m anip suivante



graph groupé dans excel



le copier , et le coller special image dans ma diapo 1 de mon PPT



mon ppt est dans D:/loic/ppt et mon xls dans D:/loic/xls



apres je travaillerai sur le positionnement de l'objet collé puis la bo ucle pour recupérer mes graph en fonction de la valeur d'une cellule



je reviendrai certainement demander de l'aide



merci