I created a function that replaces a placeholder in MailItem body (oft). It is working in my machine but not the my client machine. Where both using MS Office 365. Anyone resolved this issue?
Sub ReplaceInEmailBody(MyItem As Object, stringToReplace As String, str As String)
Dim oDoc As Word.Document
Dim myInspector As Outlook.Inspector
Set myInspector = MyItem.GetInspector
Set oDoc = myInspector.WordEditor ----> generates Application-defined or object defined error
With oDoc.Content.Find
With .Replacement
.ClearFormatting
.Font.Bold = True
End With
.Execute FindText:=stringToReplace, ReplaceWith:=str, Format:=True, _
Replace:=wdReplaceAll
End With
End Sub