I want to perform some text replacements that are just too complicated for Automatic replacement feature of Microsoft outlook. Microsoft has rather extensive documentation on Microsoft Outlook VBA scripting hosted on GitHub.
I started by pressing Alt+F11 which opened Visual Basic Editor. This is what I see in the project explorer:
Please note that I am not VBA programmer, so what I did afterwards probably looks stupid. I figured out that OutlookOutlook
namespace represents all Outlook classes, so I just picked one of the classes that sounds like a text field:
Dim WithEvents textField As Outlook.OlkTextBox
And I created a dummy event that should fire before change in text field:
Private Sub textField_BeforeUpdate(Cancel As Boolean)
MsgBox "Nope!"
Cancel = True
End Sub
Of course, when start outlook and edit message, the script doesn't get executed. So I suppose that for starter, I need to get a refference to actual text editor. How do I do that?
My question basically is, how to get this code execute when I try to edit any outlook message:
MsgBox "Nope!"
Cancel = True