How to modify Powerpoint Chart ChartData by Excel VBA

0 votes

I'm attempting to use Excel-VBA to alter ChartData (values) in Powerpoint. The other Excel Workbook is not linked to the ChartData.

Checks: - PowerPoint is open - required Presentation is open - The Chart is on Slide 4

Behavior: - Chart Title Changes - Workbook with ChartData opens - Runtime Error '424' : Objeckt Required - Debugging marks the following line:

Chart.ChartData.Workbook.Worksheets("Tabelle1").Range("B2:B5").Value = 50

Can someone please help me with this?

Sub ModifyChartData()

Dim pptApp As Object
Dim pptPres As Presentation

Set pptApp = GetObject(, "PowerPoint.Application")
Set pptPres = pptApp.ActivePresentation


pptPres.Slides(4).Shapes("Diagramm1").Chart.ChartTitle.Text = "Sales Overview"
pptPres.Slides(4).Shapes("Diagramm1").Chart.ChartData.Activate
Chart.ChartData.Workbook.Worksheets("Tabelle1").Range("B2:B5").Value = 50
Workbooks.Close

End Sub
Oct 16, 2022 in Others by Kithuzzz
• 38,000 points
3,010 views

1 answer to this question.

0 votes

Example:

enter image description here

Code:

Set pptApp = GetObject(, "PowerPoint.Application")
Set pptPres = pptApp.ActivePresentation
pptPres.Slides(1).Shapes(1).Chart.ChartTitle.Text = "Sales Overview"
pptPres.Slides(1).Shapes(1).Chart.ChartData.Activate
pptPres.Slides(1).Shapes(1).Chart.ChartData.Workbook.Worksheets("Blad1").Range("B2:B5").Value = 50

Result:

enter image description here

answered Oct 16, 2022 by narikkadan
• 63,600 points

Related Questions In Others

0 votes
2 answers

How to copy a formula horizontally within a table using Excel VBA?

Hi so basically, create an adjacent column ...READ MORE

answered Feb 16, 2022 in Others by Edureka
• 13,690 points
1,059 views
0 votes
1 answer

Excel-VBA - How to identify Target range (more than 1 cell) is deleted in a Worksheet_Change function?

You misunderstand the purpose of the function ...READ MORE

answered Sep 23, 2022 in Others by narikkadan
• 63,600 points
3,726 views
0 votes
1 answer

Excel VBA to change background image of shape by clicking on shape

You need to keep track of what ...READ MORE

answered Sep 23, 2022 in Others by narikkadan
• 63,600 points
2,919 views
0 votes
1 answer

How to print an Excel Sheet using VBA with Nitro PDF Creator in Excel 2016

you can use the built-in excel facilities ...READ MORE

answered Sep 24, 2022 in Others by narikkadan
• 63,600 points
1,353 views
0 votes
0 answers

xcel VBA Chart counting and formatting

I want to develop a macro that ...READ MORE

Oct 31, 2022 in Others by Kithuzzz
• 38,000 points
341 views
0 votes
1 answer

Using excel I need to open PPT and create ".gif" image of a ."pdf" and save it

It appears happier if you get a ...READ MORE

answered Dec 24, 2022 in Others by narikkadan
• 63,600 points
473 views
0 votes
1 answer

Name for excel graph problem with the vba generator

Change the name of the workbook : Sub Macro_name_graph2() ...READ MORE

answered Jan 7, 2023 in Others by narikkadan
• 63,600 points
738 views
0 votes
1 answer

Automating production of graphs using VBA

You have to change: chrtname = Cells(i, 2).Value To: chrtname ...READ MORE

answered Jan 23, 2023 in Others by narikkadan
• 63,600 points
815 views
0 votes
1 answer

How to paste an Excel chart into PowerPoint placeholder using Python?

Very near indeed! Copy and Paste are ...READ MORE

answered Oct 7, 2022 in Others by narikkadan
• 63,600 points
4,259 views
0 votes
1 answer

How to find a value in an excel column by vba code Cells.Find

Just use: Dim Cell As Range Columns("B:B").Select Set cell = ...READ MORE

answered Nov 17, 2022 in Others by narikkadan
• 63,600 points
3,774 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP