2017-08-16 4 views
1

おはようございます - Access to Outlookからプログラムで電子メールを作成しようとしています。Outlookユーザーを既定のメールフォントのスタイルとサイズを確認する

私は電子メールの作成方法を正しく理解していますが、フォントの種類としてユーザーの既定のメールメッセージフォントを使用する方法を理解できません。すべてのメッセージが表示されていますTimes New Roman、pt 12

フォントを特定のスタイルに設定する方法については、多くの記事がありますが、ユーザーのデフォルトのOutlookフォント設定を使用したいと思います。

Sub testHTML() 
Dim objOutlook As Outlook.Application 
Dim objOutlookMsg As Outlook.MailItem 
Dim objOutlookRecip As Outlook.Recipient 

      ' Create the Outlook session. 
      Set objOutlook = CreateObject("Outlook.Application") 

      ' Create the message. 
      Set objOutlookMsg = objOutlook.CreateItem(olMailItem) 

      With objOutlookMsg 
       ' Add the To recipient(s) to the message. 
'    Set objOutlookRecip = .Recipients.Add("Whatever Email") 
'    objOutlookRecip.Type = olTo 

      .Subject = "Testing" 
      .Display 

      'Create HTML body, which will contain a hyperlink 
       objOutlookMsg.HTMLBody = "This is the body of the email, which contains a link to Google. " & _ 
             "<a href='http://www.google.com'>www.google.com<a/>. " & _ 
             "Can you please help me figure out the font for the whole message? " & _ 
             "Why does it default to Times New Roman point 12 instead of the users' default mail font?" 
     End With 
End Sub 

答えて

0

あなたは以下を使用できます:あり

objOutlookMsg= "<BODY style=font-size:11pt;font-family:Calibri>This is the body of the email, which contains a link to Google. " & _ 
            "<a href='http://www.google.com'>www.google.com<a/>. " & _ 
            "Can you please help me figure out the font for the whole message? " & _ 
            "Why does it default to Times New Roman point 12 instead of the users' default mail font?"</BODY>" 
+0

私はCalibriサイズ11に設定したい場合、あなたのお勧めを使用することができます。しかし、私はフォントをハードコードしたくありません - 私は単純に自分の見通しのメッセージ。代替の勧告がありますか? – blimbert

+0

HTMLには3つのフォントしかないので、必要なデフォルトのフォントを使用できます。 –

0

こんにちは、私はあなたの問題を確認してください。 Outlookは外部フォントをサポートしていません。 Times New RomanはOutlookのデフォルトのフォントです。あなたはのようなシステムのデフォルトフォントを使用することができます。 arial。さらに、フォントをインラインで定義する必要があります。それがそれに対処する最善の方法です。

0

設定は HKEY_CURRENT_USER\Software\Microsoft\Office\16.0\Common\MailSettings(ここでは "16.0"はOutlook版)に格納されています。埋め込まれたフォントの名前はComposeFontSimpleバイナリ値です。 ComposeFontComplexには、新しいメッセージに使用されるHTMLテンプレートが含まれているようです。

関連する問題