不知道為什么計組老師的大量課件字體是傷害視力的亮藍色……看久了眼睛疼,想把顏色替換成保護視力一點的灰色,但是找了N久也沒找到在圖形界面上直接操作的方法,於是在MSDN上晃了晃,Google了一下,寫了個VBA小腳本,只替換選定顏色,這樣可以保留紅色或者其他顏色的高亮,順便把讓人分心的花花背景也干掉。
Sub ReplaceColor() Dim shape As shape Dim slide As slide Dim txt As TextRange On Error Resume Next '替換背景顏色為白色 ActivePresentation.SlideMaster.Background.Fill.Solid ActivePresentation.SlideMaster.Background.Fill.ForeColor.RGB = RGB(255, 255, 255) For Each slide In ActivePresentation.Slides For Each shape In slide.Shapes Set txt = shape.TextFrame.TextRange For Each sentence In txt.Sentences For Each word In sentence.Words '把藍色的文字替換成灰色 If word.Font.color.RGB = RGB(0, 0, 204) Or word.Font.color.RGB = RGB(0, 0, 122) Then With word.Font .color.RGB = RGB(40, 40, 40) End With End If Next Next Next Next End Sub
Before
After
我承認我只是在逃避復習計組………………用LP1、LP2、LP3這種標記名的匯編程序簡直不想多看一眼好嗎!!!
其實還有一點缺陷,不能替換掉表格里的字體……不過真的不能再浪費時間跑去查文檔鼓搗了(何況我幾乎不會VB=。=) 明晚就考試,復習復習……