0
VBA 코드 블록이 포함 된 Word 문서가 있습니다. 누구든지 키워드를 파란색으로 표시하고 녹색으로 주석을 지정하여 매크로를 포맷하여 VBA 편집기에 표시되는 방식으로 보입니다.Word 매크로 VBA 형식으로 텍스트 색을 지정하는 방법
VBA 코드 블록이 포함 된 Word 문서가 있습니다. 누구든지 키워드를 파란색으로 표시하고 녹색으로 주석을 지정하여 매크로를 포맷하여 VBA 편집기에 표시되는 방식으로 보입니다.Word 매크로 VBA 형식으로 텍스트 색을 지정하는 방법
이 코드를 사용하여 키워드를 강조 표시 할 수 있습니다. 이 코드는 선택한 범위를 검색하고 단어 색상을 변경하여 작동합니다.
End If
코드의 첫 부분을 추가하고 텍스트를 변경할 수 있습니다. 행운을 빈다!
Private Sub Worksheet_Change(ByVal Target As Range)
Set myRange = Range("A1:AG100") 'The Range that contains the substring you want to change color
substr = "t" 'The text you want to change color
txtColor = 3 'The ColorIndex which represents the color you want to change
For Each myString In myRange
lenstr = Len(myString)
lensubstr = Len(substr)
For i = 1 To lenstr
tempString = Mid(myString, i, lensubstr)
If tempString = substr Then
myString.Characters(Start:=i, Length:=lensubstr).Font.ColorIndex = txtColor
End If
Next i
Next myString
Set myRange = Range("A1:AG100") 'The Range that contains the substring you want to change color
substr = "u" 'The text you want to change color
txtColor = 4 'The ColorIndex which represents the color you want to change
For Each myString In myRange
lenstr = Len(myString)
lensubstr = Len(substr)
For i = 1 To lenstr
tempString = Mid(myString, i, lensubstr)
If tempString = substr Then
myString.Characters(Start:=i, Length:=lensubstr).Font.ColorIndex = txtColor
End If
Next i
Next myString
End Sub