What I will need for specific purposes:
In order to have a reference to your own VBA method, available for new mail, which will be launched with any written word / phrase (or as often as possible) or in the guide to creating an observable property of a dynamic form.
Purpose:
One feature of Outlook that might be interesting is to know its readability when composing mail. I know that you can get them by doing a spellcheck, but I would like to avoid the burden of doing a spellcheck to get the result. I would like to see the numbers go up and down as you write the letter.
Problem:
I kind of created the function I needed, but I could not find a method that could call it with every word I wrote. I would suggest that it will be something like WordEditor_Change, HTMLBody_Changeor something like that. It will be similar to Worksheet_Changethat which we have in Excel, where values can be obtained when editing an Excel worksheet.
I tried to establish the observable WordEditor.words.count, but also failed.
What I still have:
WithEvents myMail As Outlook.MailItem
Private Sub Application_ItemLoad(ByVal Item As Object)
Set myMail = Item
End Sub
Sub checkStatistics()
Dim objInsp As Outlook.Inspector
Set objInsp = myMail.GetInspector
'Enum Outlook: https://msdn.microsoft.com/es-es/VBA/Outlook-VBA/articles/olobjectclass-enumeration-outlook
If objInsp.EditorType = olEditorWord Then ' outlook 2013
'Doc obj: https://msdn.microsoft.com/en-us/vba/word-vba/articles/document-object-word
Set objdoc = objInsp.WordEditor
Dim var As ClassHandlesEvent
Dim tst As classWithEvent
Set var = New ClassHandlesEvent
Set tst = New classWithEvent
var.EventVariable = tst
tst.value = objdoc.Words.Count
MsgBox objdoc.ReadabilityStatistics(9) & ": " & objdoc.ReadabilityStatistics(9).value & vbCrLf & "(Ideal values above 60)"
MsgBox objdoc.ReadabilityStatistics(8) & ": " & objdoc.ReadabilityStatistics(8).value & vbCrLf & "(Ideal values above 60)"
End If
Set objdoc = Nothing
Set objInsp = Nothing
End Sub
source
share