Sub ChangeTextColor() Dim shp As Shape Dim rng As TextRange Dim currentColor As String Dim newColor As String Dim userInput As String Dim sel As Selection Dim fontColor As Long Dim colorCount As Collection ' ¼±ÅÃµÈ ÅØ½ºÆ® °¡Á®¿È On Error Resume Next Set sel = ActiveWindow.Selection If sel.Type = ppSelectionText Then Set rng = sel.TextRange ElseIf sel.Type = ppSelectionShapes Then If sel.ShapeRange(1).HasTextFrame Then Set rng = sel.ShapeRange(1).TextFrame.TextRange End If End If On Error GoTo 0 ' ¼±ÅÃµÈ ÅØ½ºÆ®°¡ ¾øÀ¸¸é ¸Þ½ÃÁö Ç¥½Ã If rng Is Nothing Or rng.Text = "" Then MsgBox "ÅØ½ºÆ®¸¦ ¼±ÅÃÇϼ¼¿ä.", vbExclamation Exit Sub End If ' ÅØ½ºÆ® »ö»ó °³¼ö È®ÀÎ Set colorCount = New Collection On Error Resume Next Dim i As Integer For i = 1 To rng.Characters.Count colorCount.Add rng.Characters(i).Font.Color.RGB, CStr(rng.Characters(i).Font.Color.RGB) Next i On Error GoTo 0 If colorCount.Count > 1 Then MsgBox "ÅØ½ºÆ® »óÀÚ¿¡ »ö»óÀÌ 2°³ ÀÌ»ó ÀÖ½À´Ï´Ù. ÇϳªÀÇ »ö»ó ÅØ½ºÆ®¸¸ ¼±ÅÃÇϼ¼¿ä.", vbExclamation Exit Sub End If ' ÇöÀç ÅØ½ºÆ® »ö»ó ÄÚµå °¡Á®¿À±â fontColor = rng.Font.Color.RGB currentColor = Right("000000" & Hex(fontColor), 6) ' ÀÔ·Â ¹Ú½º ±¸¼º (ÇÑ ÁÙ ÀÔ·Â) userInput = InputBox("ÇöÀç ÅØ½ºÆ® »ö»ó ÄÚµå: #" & currentColor & vbCrLf & _ "º¯°æÇÒ ÅØ½ºÆ® »ö»ó ÄÚµå (6ÀÚ¸®, ¿¹: 123ABC):", "ÅØ½ºÆ® »ö»ó º¯°æ") ' ÀԷ°ª À¯È¿¼º °Ë»ç If Len(userInput) <> 6 Or Not IsHex(userInput) Then MsgBox "¿Ã¹Ù¸¥ 6ÀÚ¸® »ö»ó Äڵ带 ÀÔ·ÂÇϼ¼¿ä.", vbExclamation Exit Sub End If ' »ö»ó º¯°æ newColor = RGB(CInt("&H" & Mid(userInput, 1, 2)), _ CInt("&H" & Mid(userInput, 3, 2)), _ CInt("&H" & Mid(userInput, 5, 2))) On Error Resume Next ' ¸ðµç ÅØ½ºÆ® »ö»ó º¯°æ Dim sld As Slide Dim s As Shape Dim tr As TextRange For Each sld In ActivePresentation.Slides For Each s In sld.Shapes If s.HasTextFrame Then Set tr = s.TextFrame.TextRange For i = 1 To tr.Characters.Count If Right("000000" & Hex(tr.Characters(i).Font.Color.RGB), 6) = currentColor Then tr.Characters(i).Font.Color.RGB = newColor End If Next i End If Next s Next sld On Error GoTo 0 MsgBox "ÅØ½ºÆ® »ö»óÀÌ º¯°æµÇ¾ú½À´Ï´Ù.", vbInformation End Sub Function IsHex(value As String) As Boolean Dim i As Integer IsHex = True For i = 1 To Len(value) Select Case Mid(value, i, 1) Case "0" To "9", "A" To "F", "a" To "f" ' Do nothing, valid character Case Else IsHex = False Exit Function End Select Next i End Function