Is it possible to develop a .vbs script that automatically changes the default font for Outlook 2016?

John Levi 1 Reputation point
2022-11-12T10:21:12.603+00:00

I'm relatively new to Visual Basic Scripting and I've been tasked to develop a .vbs script that automatically changes the default Calibri font in Outlook 2016 to Montserrat including the existing emails upon double-clicking the program. I'm not really sure if this is possible and I cannot seem to find a reference or starting point for me to write the script. I've been reading the documentation provided as well as those present in StackOverflow but I seem to have reached an impasse. I've created some trial scripts and opened up an Outlook 2016 instance but it seems that it does not do anything in particular.

Here is what I have so far:

Sub ChangeFont()

    Dim objOLApp

    Dim NewTask

    Set objOLApp = CreateObject("Outlook.Application")

    Set NewTask = objOLApp.CreateItem(0)

    On Error Resume Next

           ' Error: Script may not be compatible with your existing device  

    with Newtask

        .Font.Name = "Montserrat"

    End With

    On Error GoTo 0

    Set objOLApp = Nothing

    Set NewTask = Nothing

END Sub

Any help or suggestions regarding this would be highly appreciated. I'm stuck in this task for almost a week now.
I have no idea how to achieve this state in my configs:

259758-image.png

Outlook | Windows | Classic Outlook for Windows | For business
Developer technologies | Visual Basic for Applications
0 comments No comments
{count} votes

3 answers

Sort by: Most helpful
  1. Eugene Astafiev 891 Reputation points
    2022-11-12T12:23:32.523+00:00

    First, in the code you are creating a new MailItem instance, not a task item like it was named.

    Second, Outlook items like MailItem or TaskItem don't provide the DefaultFont property.

    Third, I've already described possible ways of changing the font-related properties in Outlook. Check out your post - Automatically Change Default Font of Outlook 2016 using Visual Basic Script. In brief, you can use the HTML markup to specify a custom font or use the Word object model to deal with item bodies.

    Fourth, you can find some Outlook settings in the Windows registry. So, to locate where exactly Outlook keeps Outlook settings I'd suggest using the Process Monitor utility, so you could do the required changes in the UI and track where they are saved.

    0 comments No comments

  2. John Korchok 6,306 Reputation points Volunteer Moderator
    2022-11-12T18:01:39.357+00:00

    Outlook has been designed to make a default font change possible without any programming. Your Office templates folder includes a NormalEmail.dotm file that sets the default formatting for new emails. To edit it:

    1. Close Outlook.
    2. Open a File Explorer window. Paste in this location, then press the Return key:
      %appdata%\Microsoft\Templates\
    3. Open NormalEmail.dotm in Word. Do not double-click to do this, that just creates a new document from the template. Instead, right-click on the file and choose Open.
    4. Choose Design>Fonts>Customize Fonts.
    5. Create a font theme using Montserrat, then click on the Save button.
    6. Save NormalEmail.dotm. Close Word.
    7. Open Outlook and create a new email to test.
      Please note that replying to email will not automatically format replies with Montserrat. That's because the font theme of the email is set by the creator of the original email.
    0 comments No comments

  3. Oskar Shon 866 Reputation points
    2022-11-14T11:38:59.23+00:00

    Mail used default mail settings from general template.
    You can use it and change font based on HTML code, or you can create new template and create mail from this template.

      Dim oNewMail As MailItem  
      Set oNewMail = Application.CreateItemFromTemplate("c:\path\Template.oft")  
    

    I do some changes and I like to know how is a mail works in Outlook, so I build and use addin for it. You can read about that there: translate

    260162-image.png

    Regards

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.