Results 1 to 20 of 36

Thread: Change Fill color using VBA in PowerPoint

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1

    Change Fill color using VBA in PowerPoint

    I have 10 hexagon shape(having other shape also ie rectangle, square) & having four animation(Entrance:Appear, Motion paths : down, Emphasis:Fill color(given Blue color), Motion paths:Left) with fixed delay.
    During starting animation(during entrance) hexagon color is Red & when meet emphasis animation it become Blue color & remain Blue for remaining animations.
    Now I want to change both color through VBA code. I am abale to change only entrance color(ie Red to my coustom color) through below code:




    Sub addColorhexagon()
        Dim hshp As Shape
        Dim osld As Slide
        Dim r As Long
        Dim g As Long
        Dim b As Long
        On Error Resume Next
        r = InputBox("Please enter Red number in: RGB(red,green,blue)", "Change Top Shape Color", "068")
        g = InputBox("Please enter Green number in: RGB(red,green,blue)", "Change Top Shape Color", "114")
        b = InputBox("Please enter Blue number in: RGB(red,green,blue)", "Change Top Shape Color", "196")
        Set osld = ActivePresentation.Slides(1)
        For j = 1 To 10
           Set hshp = osld.Shapes("hexagon" & j)
           hshp.Fill.ForeColor.RGB = RGB(r, g, b)
           hshp.Fill.Solid
        Next j
        On Error GoTo errhandler
        Exit Sub
        errhandler:
        MsgBox "Opps!"
    End Sub
    So How can I change the Blue color (Emphasis:Fill color ie Blue) to my custom color?
    Please help
    Last edited by Aussiebear; 03-10-2025 at 07:01 AM.

Tags for this Thread

Posting Permissions

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