Excel macro to ppt

Closed
Nits - Apr 22, 2010 at 09:34 AM
 Nits - Apr 22, 2010 at 03:47 PM
I am currently working on a requirement where the excel shoud automate powerpoint..

For eg
Jan Feb Mar
East 10 30 40
West 13 14 45
South 34 35 33

Each row in the excel should generate a seperate slide.
So as per the data we r supposed to have 3 slides..

I was able to code in such a way it works for a single slide and get updated automatically when the months grows
But i am not able to get for more than one slide.Please can you give me a clue to continue..
I am really struck with this..

Sub Chart2PPT()
Dim objPPT As Object
Dim objPrs As Object
Dim objGraph As Object
Dim objDataSheet As Object
Dim rngData As Range
Dim intRow As Integer
Dim intCol As Integer

' excel chart data
Set rngData = Range("A1:J2")
' open powerpoint
Set objPPT = CreateObject("Powerpoint.application")
objPPT.Visible = True
' existing powerpoint pres
objPPT.Presentations.Open "C:\PPt\Call_volume.ppt"
' chart on slide 2
Set objPrs = objPPT.Presentations(1).slides(2)
' pointer to graph
Set objGraph = objPrs.Shapes(2).OLEFormat.Object.Application
' pointer to graphs data sheet
Set objDataSheet = objGraph.Datasheet
' transfer data
For intRow = 1 To rngData.Rows.Count
For intCol = 1 To rngData.Columns.Count
objDataSheet.Cells(intRow, intCol) = rngData.Cells(intRow, intCol)
Next
Next
' update to keep changes
objGraph.Update
objGraph.Quit
objPPT.Presentations(1).Save


' tidy up objects
Set rngData = Nothing
Set objGraph = Nothing
Set objDataSheet = Nothing
Set objPrs = Nothing
Set objPPT = Nothing
End Sub
Related:

11 responses

rizvisa1 Posts 4478 Registration date Thursday January 28, 2010 Status Contributor Last seen May 5, 2022 766
Apr 22, 2010 at 01:02 PM
Could you please upload a sample file on some shared site like https://authentification.site and post back here the link to allow better understanding of how it is now and how you foresee.
0
Basically I am try to automate a PPT slide from Excel macros..
I am able to get what I want But only one slide is create for EAST for the months of Jan to mar ..The other slide for west and south is not done..
0
rizvisa1 Posts 4478 Registration date Thursday January 28, 2010 Status Contributor Last seen May 5, 2022 766
Apr 22, 2010 at 02:08 PM
Why not execute the macro in a loopi
0
I am newbie to VBA..Please could you explain me how to proceed
0

Didn't find the answer you are looking for?

Ask a question
rizvisa1 Posts 4478 Registration date Thursday January 28, 2010 Status Contributor Last seen May 5, 2022 766
Apr 22, 2010 at 02:25 PM
Could you put this file C:\PPt\Call_volume.ppt as a sample on a shared site like I suggested earlier
0
I tried but I couldnt used suggest me another website..
i am not able to access the one..
Is there anyother way i can send it to you
0
rizvisa1 Posts 4478 Registration date Thursday January 28, 2010 Status Contributor Last seen May 5, 2022 766
Apr 22, 2010 at 02:35 PM
rizvisa at hotmail dot com
0
rizvisa1 Posts 4478 Registration date Thursday January 28, 2010 Status Contributor Last seen May 5, 2022 766
Apr 22, 2010 at 03:04 PM
In PPT you have only one slide. So would there be three sheets already in this ppt or each time this ppt would be saved with a different name or is it some thing else
0
This PPT should run monthly once..
So for each row in the excel sheet there shud be a slide..
For eg
we have data for EAST WEST SOUTH..for 3 months..
for there shud be 3 slide for each zone..
So as the data grows when the months increases the charts shud be updated automatically..
So its the same PPT getting updated every month.
0
rizvisa1 Posts 4478 Registration date Thursday January 28, 2010 Status Contributor Last seen May 5, 2022 766
Apr 22, 2010 at 03:23 PM
I think I was not able to explain. So in the initial design of the power point, there would be already three sheets??, Also though in sheet you are using months but in ppt, those month values are there are qtr.
0
Please check the new files which i have send to you..
Thanks
0