Consulting

Results 1 to 4 of 4

Thread: Border Color of chart object does not work

  1. #1
    VBAX Regular
    Joined
    May 2015
    Location
    Kuala Lumpur, Malaysia
    Posts
    11
    Location

    Border Color of chart object does not work

    Hi,

    Can anyone help me? The line color code does not working.
    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)
    
    
    "
    "

  2. #2
    VBAX Master
    Joined
    Feb 2007
    Posts
    2,094
    Location
    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
    John Wilson
    Microsoft PowerPoint MVP
    Amazing Free PowerPoint Tutorials
    http://www.pptalchemy.co.uk/powerpoi...tutorials.html

  3. #3
    VBAX Regular
    Joined
    May 2015
    Location
    Kuala Lumpur, Malaysia
    Posts
    11
    Location
    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.

  4. #4
    VBAX Master
    Joined
    Feb 2007
    Posts
    2,094
    Location
    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.
    John Wilson
    Microsoft PowerPoint MVP
    Amazing Free PowerPoint Tutorials
    http://www.pptalchemy.co.uk/powerpoi...tutorials.html

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •