Question posted 2009 · +10 upvotes
The task is to apply strikeout to current font in selected text area. The difficulty is that Outlook doesn’t support recording macros on the fly – it wants code to be written by hand.
For example, the following simple code:
Selection.Font.Strikethrough = True
works for Word, but gives an error for Outlook:
Run-time error '424':
Object required
Accepted answer +13 upvotes
This assumes that you also have Word installed on your box. If so, you can access most of the Word OM from the Outlook VBE without referencing Word by using the ActiveInspector.WordEditor object.
Sub StrikeThroughinMailItem()
Dim objOL As Application
Dim objDoc As Object
Dim objSel As Object
Set objOL = Application
Set objDoc = objOL.ActiveInspector.WordEditor
Set objSel = objDoc.Windows(1).Selection
objSel.Font.Strikethrough = True
End Sub
Outlook VBA objects referenced (3)
Application— Using events with the Application objectApplication— Working with Other ApplicationsSelection— Working with the Selection Object