構文
Application.StandardFont
StandardFont・・・Excelアプリケーションの標準フォント名を取得/設定
Applicationオブジェクトの StandardFont プロパティでExcelの標準フォント名を取得/反映します。
StandardFontプロパティのサンプルコード
Public Sub sample() '■セルA1のフォントを「標準フォント」にする Range("A1").Font.Name = Application.StandardFont '■セルA1を含む表に対して、フォントを「標準フォント」にする Range("A1").CurrentRegion.Font.Name = Application.StandardFont '■シート全体のフォントを「標準フォント」にする Cells.Font.Name = Application.StandardFont '■セルA1のフォントを標準フォントへ設定する Application.StandardFont = Range("A1").Font.Name '■「MS Pゴシック」を標準フォントへ設定する Application.StandardFont = "MS Pゴシック" '■現在設定されている標準フォントを取得する Debug.Print Application.StandardFont 'MS Pゴシック End Sub
注意点
- セルのフォントを取得や設定する場合はFont.Nameプロパティを使用します。
- StandardFontプロパティが反映されるのは、Excelの再起動後です。
変更後に新規で開くすべてのExcelブックに適用されます。
コメント