Results 1 to 3 of 3

Change border color of grouped element

Threaded View

  1. #1
    Registered User
    Join Date
    03-02-2016
    Location
    Netherlands
    MS-Off Ver
    2013
    Posts
    15

    Change border color of grouped element

    Hi all,

    I've written a macro which changes the border color of a shape in Powerpoint (toggling between pre-defined colors).

    Now, this works fine, however, when a shape is grouped, the macro won't change the color of the shape (it will only change to black once (because of the ELSE statement) ).
    Ideally, it would change color of the borders of all members/shapes in the group.
    Ideally, one would select the group, and run the macro, and the outer shape changes the border color (Also see attached dummy powerpoint).


    Does any of you know how to re-write the below to suit this?

    Public Enum Color
            PADPurple = 13964777    'RGB(233, 21, 213)
            PADYellow = 49407       'RGB(255, 192, 0)
            PADBlue = 15773696      'RGB(0, 176, 240)
            PADBlack = 0            'RGB(0, 0, 0)
        End Enum
    
    Sub ChangeBorderColor()
        'This macro can be used to quickly change image border colors in Powerpoint.
        'It's advised to bind this macro to a keyboard shortcut (i.e. CTRL + > )
      On Error GoTo Errorhandler
      
        Dim myPic As ShapeRange
        Set myPic = ActiveWindow.Selection.ShapeRange
        
        Dim CurColor
        
        If Not ActiveWindow.Selection.Type = 2 Then
            Debug.Print ("Selected object is not a Shape type")
            Exit Sub
        End If
    
        'Retrieve current border color
            CurColor = myPic.Line.ForeColor.RGB
            
        'Change color
            Select Case CurColor
                Case Color.PADBlack
                    Debug.Print ("Black > Purple")
                    myPic.Line.ForeColor.RGB = Color.PADPurple
                    
                Case Color.PADPurple
                    Debug.Print ("Purple > Blue")
                    myPic.Line.ForeColor.RGB = Color.PADBlue
                
                Case Color.PADBlue
                    Debug.Print ("Blue > Yellow")
                    myPic.Line.ForeColor.RGB = Color.PADYellow
                    
                Case Color.PADYellow
                    Debug.Print ("Yellow > Black")
                    myPic.Line.ForeColor.RGB = Color.PADBlack
                    
                Case Else
                    myPic.Line.ForeColor.RGB = Color.PADBlack
                    Debug.Print ("Unknown color > Black")
            End Select
            
            
        Debug.Print ("Color changed")
    Errorhandler:
    End Sub

    Thanks in advance!
    A.
    Attached Files Attached Files
    Last edited by Arnodekkers1995; 10-09-2018 at 09:37 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Change TextBox Border Color
    By ldoodle in forum Outlook Programming / VBA / Macros
    Replies: 2
    Last Post: 06-06-2018, 02:45 PM
  2. Outside border change color
    By DanS52 in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 09-14-2017, 12:55 PM
  3. [SOLVED] Click oval option button to fill/unfill color, also change border color to match fill
    By Rocky2013 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-07-2015, 08:29 PM
  4. Border color doesn't change.
    By Rusty in forum Excel General
    Replies: 3
    Last Post: 03-10-2006, 01:45 AM
  5. how to change form border color?
    By dpenny in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-31-2006, 09:44 PM
  6. Change the border color used by Change Tracking
    By Jim Stoaks in forum Excel General
    Replies: 1
    Last Post: 01-20-2006, 05:40 PM
  7. Replies: 3
    Last Post: 11-02-2005, 07:55 PM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1