0
Outlook 2016で転送または返信する電子メールの変更を実行する必要があります。これを達成するために、私は次のコードを持っています。このコードはInlineResponseウィンドウに修正を(空と正規表現値を置き換える)を実行:InlineResponseのOutlookでVBAを使用すると、標準的な動作が中断されます。どうして?
Dim myOlApp As New Outlook.Application
Public WithEvents myOlExplorer As Outlook.Explorer
Public Sub Initialize_handler()
Set myOlExplorer = myOlApp.ActiveExplorer
End Sub
Private Sub myOlExplorer_InlineResponse(ByVal Item As Object)
' first replace using the word editor
Dim oDoc As Word.Document
Dim wdSelection As Word.Selection
Set oDoc = Item.GetInspector.WordEditor
Set wdSelection = oDoc.Application.Selection
wdSelection.Find.ClearFormatting
wdSelection.Find.replacement.ClearFormatting
With wdSelection.Find
.Text = "SPECIFIC TEXT WITH A VARIABLE LENGTH OF SPACES OF DIFFERENT KINDS AFTER THAT I NEED TO INCLUDE [!a-zA-Z0-9]*([a-zA-Z0-9])" ' my regex goes in here the a-zA-Z0-9 part is to work around the non-greedy regex.
.replacement.Text = "\1"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = True
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
wdSelection.Find.Execute Replace:=wdReplaceAll
End Sub
をしかし、私は(罰金全体的に動作します)このコードを実行すると、Outlookからいくつかのデフォルトの動作が壊れています。例:
- ドラフトメッセージは保存されません。私は、インライン応答ウィンドウで返信、タイプの何かをヒットし、そのメッセージを残す場合は、
おそらく、より多くの機能が動作しません、クリップボードから
この場合、myOlExplorer.ActiveInlineResponseWordEditor – Jeroen