[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Change data label fill texture

Posted on 2013-06-26
1
Medium Priority
?
801 Views
Last Modified: 2013-10-24
I am trying to change the type of fill on a data label in selected graphs in PowerPoint. When I try to change the fill type properties, it returns "Wrong number of arguments or invalid property assignment"

I can't figure out whats wrong...

Private Sub CommandButton1_Click()
    Dim shp As Shape
    Dim cht As Chart

    If ActiveWindow.Selection.ShapeRange.Count > 0 Then
    
        C = ActiveWindow.Selection.ShapeRange.Count
        ReDim Nom_Obj(C + 1)
        For CC = 1 To C
            Nom_Obj(CC) = ActiveWindow.Selection.ShapeRange(CC).Name
        Next CC
        
        For CC = 1 To C
            ActiveWindow.Selection.SlideRange.Shapes.SelectAll
            ActiveWindow.Selection.ShapeRange(Nom_Obj(CC)).Select
            Set shp = ActiveWindow.Selection.SlideRange.Shapes(Nom_Obj(CC))
            
            If (shp.Type = 3) Then
                'graph
                Set cht = shp.Chart
                cht.SeriesCollection(1).ApplyDataLabels
                cht.SeriesCollection(1).DataLabels.Select
                If cht.SeriesCollection(1).DataLabels.Fill.Type = msoFillPatterned Then
                    'BUG HERE
                    cht.SeriesCollection(1).DataLabels.Fill.Type = msosolidfill
                ElseIf cht.SeriesCollection(1).DataLabels.Fill.Type = msosolidfill Then
                    'BUG HERE
                    cht.SeriesCollection(1).DataLabels.Fill.Type = msoFillPatterned
                End If
                cht.SeriesCollection(1).DataLabels.Fill.ForeColor.RGB = RGB(255, 255, 255)
                cht.SeriesCollection(1).DataLabels.Fill.BackColor.RGB = RGB(255, 255, 255)
            End If
            
            Set shp = Nothing
            Set cht = Nothing
            
        Next CC

    End If
End Sub

Open in new window

1.pptx
0
Comment
Question by:theomysh
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 23

Accepted Solution

by:
JSRWilson earned 2000 total points
ID: 39285866
Fill.Type is Read Only

Also note the method to change Forecolor and Backcolor (If they are the same value you wont see a pattern) You need to specify the pattern for a patterned fill.

Try something like this

                If cht.SeriesCollection(1).DataLabels.Format.Fill.Type = msoFillPatterned Then
                    cht.SeriesCollection(1).DataLabels.Format.Fill.Solid
                ElseIf cht.SeriesCollection(1).DataLabels.Format.Fill.Type = msoFillSolid Then
                    cht.SeriesCollection(1).DataLabels.Fill.Patterned (msoPatternDashedHorizontal)
                End If
                cht.SeriesCollection(1).DataLabels.Format.Fill.ForeColor.RGB = RGB(255, 255, 255)
                cht.SeriesCollection(1).DataLabels.Format.Fill.BackColor.RGB = RGB(255, 0, 0)
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

People often ask "How do I make this macro run every time I show a new slide or add a new slide etc." This means making PowerPoint respond to that EVENT and, unlike in Excel, it's not that easy! First, I would avoid using the pseudo events left o…
Background   Certain code in VBA requires initialization, such as application events. The app initialization is often triggered by the Auto_Open sub which is a special procedure that runs when an add-in loads. More significantly, this sub does n…
This video teaches viewers how to fit pictures into slides, crop and remove backgrounds, and alter photos to look more professional.
The viewer will learn how to edit text. This includes Font, Spacing, Resizing, Color, and other special text options.

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question