Witzker
Senior Member
- OS Version(s)
- iOS
- Outlook version
- Outlook 2019 32-bit
- Email Account
- Exchange Server 2007
Code:
Sub SetCursorAndFocus() ' Cursor appears in body, but focus stays in field where it was when calling the macro
Dim objItem As Object
Set objItem = Outlook.Application.ActiveInspector.CurrentItem
If objItem Is Nothing Then
MsgBox "No item is open."
Exit Sub
End If
Dim objWordDoc As Word.Document
Set objWordDoc = objItem.GetInspector.WordEditor
If objWordDoc Is Nothing Then
MsgBox "The open item is not a Word document."
Exit Sub
End If
Dim objWordApp As Word.Application
Set objWordApp = objWordDoc.Application
' Set the cursor to the end of the text field
objWordApp.Selection.EndKey wdStory, wdMove
' Set the focus to the text field
objWordApp.Selection.Range.Select
Application.Activate
End Sub
Result when calling the macro when cursor is not in the body field:
Cursor appears in body, but focus stays in field where it was when calling the macro
after calling macro
Pls. Help to get this finally working.
I would need this procedure in connection with other macro
Many THX for taking care
------------------------------
PS: this is activated
Something missing?
Last edited: