PDA

View Full Version : Border Color of chart object does not work



Faridwahidi
06-17-2015, 02:36 AM
Hi,

Can anyone help me? The line color code does not working. :crying:
I want to color the border of object.




Set mySlide = pres.Slides.Add(1, ppLayoutTitleOnly)
"
"
"

ElseIf Rsht.Name = "Chart" Then
Rsht.ChartObjects("Chart 1").Activate
ActiveChart.ChartTitle.Font.Size = 12
ActiveChart.PlotArea.Select
ActiveChart.ChartArea.Copy

Set myShapeRange = mySlide.Shapes.PasteSpecial(ppPasteDefault)
myShapeRange.Left = 17
myShapeRange.Top = 300
myShapeRange.Width = 420
myShapeRange.Height = 190
myShapeRange.Line.Visible = msoTrue
myShapeRange.Line.Weight = 2
myShapeRange.Line.ForeColor.RGB = RGB(255, 192, 0)


"
"

John Wilson
06-18-2015, 08:09 AM
Does this get you closer


Dim myslide As PowerPoint.Slide
Dim ocht As PowerPoint.Chart
Dim myShape As PowerPoint.Shape
Set myslide = ActivePresentation.Slides(1)
Set myShape = myslide.Shapes.PasteSpecial(ppPasteDefault)(1)
myShape.Left = 17
myShape.Top = 300
myShape.Width = 420
myShape.Height = 190
If myShape.HasChart Then
With myShape.Chart.ChartArea.Format.Line
.Visible = msoTrue
.Weight = 2
.ForeColor.RGB = RGB(255, 192, 0)
End With
End With

Faridwahidi
06-18-2015, 05:47 PM
Hi John,

Thanks for the alternative method.

It works when I change from .Visible = msoTrue to .Visible = msoCTrue

Is there any differences between these two functions.

John Wilson
06-18-2015, 09:40 PM
msoCTrue assigns a value of +1 whereas True and msoTrue assign -1.(-1 is what vba usually expects) I've never seen an example where +1 was preferred though it usually works.