brajcool
MIS
- Jun 21, 2015
- 11
Hello Friends,
I'm new to this forum and this is my first post.
I need help of you guys to solve a headache.
Currently I'm working on a project which require to change the Bar colors as per values of Excel linked graphs.
The problem is when the values changed in Excel sheet, values change on PPT graph also but the color of Bar doesn't change.
There are several slides and on every slide there is only one graph. Please refer attached PowerPoint Presentation
I have found one code on your forum, however as I'm new to PowerPoint VBA, not able to convert as per my use, however make some changes though but I stuck where need to set Chart:
Sub atest()
Dim sl As Slide, sh As Shape, ch As Chart, s As Series
For Each sl In ActivePresentation.Slides
For Each sh In sl.Shape
If sh.Type = 3 Then
Set ch = sh.OLEFormat.Object 'here I stuck. Error Message "OLEFormat (unknown number) : Invalid Request. This property only applies to OLE Objects"
sh.Select
i = 1
For Each s In ch.SeriesCollection
Select Case i
Case 1
s.Interior.Color = RGB(0, 34, 76)
Case 2
s.Interior.Color = RGB(174, 188, 158)
Case 3
s.Interior.Color = RGB(111, 150, 201)
End Select
i = i + 1
Next
End If
Next
Next
End Sub
Please help as this is very urgent project and I am very much stuck into it.
I'm new to this forum and this is my first post.
I need help of you guys to solve a headache.
Currently I'm working on a project which require to change the Bar colors as per values of Excel linked graphs.
The problem is when the values changed in Excel sheet, values change on PPT graph also but the color of Bar doesn't change.
There are several slides and on every slide there is only one graph. Please refer attached PowerPoint Presentation
I have found one code on your forum, however as I'm new to PowerPoint VBA, not able to convert as per my use, however make some changes though but I stuck where need to set Chart:
Sub atest()
Dim sl As Slide, sh As Shape, ch As Chart, s As Series
For Each sl In ActivePresentation.Slides
For Each sh In sl.Shape
If sh.Type = 3 Then
Set ch = sh.OLEFormat.Object 'here I stuck. Error Message "OLEFormat (unknown number) : Invalid Request. This property only applies to OLE Objects"
sh.Select
i = 1
For Each s In ch.SeriesCollection
Select Case i
Case 1
s.Interior.Color = RGB(0, 34, 76)
Case 2
s.Interior.Color = RGB(174, 188, 158)
Case 3
s.Interior.Color = RGB(111, 150, 201)
End Select
i = i + 1
Next
End If
Next
Next
End Sub
Please help as this is very urgent project and I am very much stuck into it.