Hello, I've done lots of searching online on this and haven't found a single similar post.
I have an Outlook macro that adds tomorrow's date for me at the push of a button. I want to modify the macro to check if a date was previously inserted, and if so adjust that date forward 1 day. I can write the logic that will check the date, but I'm at a complete blank of how to highlight (select) the text adjacent to my cursor (I don't want to have to highlight it manually). My current macro is below. All I want is the line(s) of code that essentially does the same as a Ctrl + Shift + Left Arrow Key (repeated 5 times). I can handle the rest of the logic from there.
Sub TimeStamp_PlusOne()
If TypeName(ActiveWindow) = "Inspector" Then
If ActiveInspector.IsWordMail And ActiveInspector.EditorType = olEditorWord Then
'want code to select text left of current cursor position
if SelectedText = tomorrow's date, then
'code to replace text with day after tomorrow's date (I can write this part)
else
ActiveInspector.WordEditor.Application.Selection.TypeText Format(Date + 1, "mmm d (ddd)")
End If
End If
End If
End Sub
Bookmarks