![Outlook 2010 のリボン ボタンでフォントを変更できますか?](https://rvso.com/image/1400015/Outlook%202010%20%E3%81%AE%E3%83%AA%E3%83%9C%E3%83%B3%20%E3%83%9C%E3%82%BF%E3%83%B3%E3%81%A7%E3%83%95%E3%82%A9%E3%83%B3%E3%83%88%E3%82%92%E5%A4%89%E6%9B%B4%E3%81%A7%E3%81%8D%E3%81%BE%E3%81%99%E3%81%8B%3F.png)
Outlook 2010 リボンに、強調表示されたテキストのフォントを「Courier New」に変更し、フォント サイズを 10 ポイントに縮小するボタンを追加することは可能ですか? ドキュメント全体ではなく、強調表示されたテキストだけです。
これを行うには、フォントを 2 回クリックし、フォント サイズを 2 回クリックする必要があるため、手根管が悪化します。
答え1
マクロを使用すると機能しますが、マクロを有効にする必要があり、Outlook で警告が表示されます。
マイクロソフトmaros を有効にし、マクロを作成し、それをリボンに追加する方法を示します。
https://stackoverflow.com/questions/20624331/vba-macro-to-highlight-selected-text-in-current-email-message回答には、現在選択されているテキストに変更を加えるコードが含まれています。
フォントを courier new、10 ポイント、太字、黒に変更するには、2 番目のリンクから派生した次のマクロを使用します。
Sub ChangeSelectedFontToCode()
Dim msg As Outlook.MailItem
Dim insp As Outlook.Inspector
Set insp = Application.ActiveInspector
If insp.CurrentItem.Class = olMail Then
Set msg = insp.CurrentItem
If insp.EditorType = olEditorHTML Then ' outlook 2003
Set hed = msg.GetInspector.HTMLEditor
Set rng = hed.Selection.createRange
rng.pasteHTML "<b><font style='color: black; font-size: 10pt; font-family:Courier New;'>" & rng.Text & "</font></b>"
End If
If insp.EditorType = olEditorWord Then ' outlook 2013
Set hed = msg.GetInspector.WordEditor
Set appWord = hed.Application
Set rng = appWord.Selection
rng.Font.Size = 10
rng.Font.Color = wdColorBlack
rng.Font.Bold = True
rng.Font.Name = "Courier New"
rng.Collapse Direction:=wdCollapseEnd
End If
End If
Set appWord = Nothing
Set insp = Nothing
Set rng = Nothing
Set hed = Nothing
Set msg = Nothing
End Sub