
Dear @Alexander Howard,
Thank you so much for contacting Microsoft Q&A Forum.
Based on your description, it's absolutely possible to apply Word-style formatting to Outlook email text using VBA, though it requires a bit more setup than in Word. However, you cannot run VBA macros in Outlook Web App (OWA) or the New Outlook interface that mimics the web version. This is because:
- OWA is browser-based and does not support the COM (Component Object Model) architecture that VBA relies on.
- New Outlook, which is essentially a web-based client wrapped in a desktop shell, also lacks support for VBA and other developer tools like PST import/export.
- You can't access the Visual Basic Editor or run macros using Alt + F11 in OWA or New Outlook.
References:
- Feature comparison between new Outlook and classic Outlook - Microsoft Support
- Why wont the new Outlook support vba? - Microsoft Q&A
So, only the classic Outlook desktop application (also known as Outlook for Windows) supports running VBA macros. The macro is designed to apply a specific Word style (like "Text") to the selected text in the body of an email you're composing in Outlook. This is useful if you want consistent formatting across emails using predefined styles, just like you do in Word.
You can see in this article to know the setup for VBA macro in classic Outlook: How to automate tasks in Outlook using macros – Microsoft 365
Kindly note: make sure macro security is set to allow macros: Go to File > Options > Trust Center > Trust Center Settings > Macro Settings.
Besides that, if you want to use Classic Outlook, download it to use on your computer via: Install or reinstall classic Outlook on a Windows PC - Microsoft Support. And if you have installed the Classic Outlook, you can click Help in the menu bar and select "Go to Classic Version".
Also, I have a sample suggestion for VBA code that you can check if it can help after finishing the setup (you can consult other online codes):
Public Sub ApplyTextStyle()
Dim objItem As Object
Dim objInsp As Outlook.Inspector
Dim objWord As Word.Application
Dim objDoc As Word.Document
Dim objSel As Word.Selection
On Error Resume Next
' Get the current email item
Set objItem = Application.ActiveInspector.CurrentItem
If Not objItem Is Nothing Then
If objItem.Class = olMail Then
Set objInsp = objItem.GetInspector
' Ensure the editor is Word
If objInsp.EditorType = olEditorWord Then
Set objDoc = objInsp.WordEditor
Set objWord = objDoc.Application
Set objSel = objWord.Selection
' Apply the style named "Text"
objSel.Style = objDoc.Styles("Text")
End If
End If
End If
' Clean up
Set objItem = Nothing
Set objInsp = Nothing
Set objWord = Nothing
Set objDoc = Nothing
Set objSel = Nothing
End Sub
I hope this information can help you to understand about this feature and please correct me if I misunderstand your concern.
Wish you a pleasant day!
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.