View Single Post
 
Old 02-09-2022, 05:16 PM
Guessed's Avatar
Guessed Guessed is offline Windows 10 Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 4,159
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

I'm not able to test but perhaps this concept would work unless the selection range is exactly the same size as the autotext being inserted
Code:
Sub SmartEnter()
  Dim iStart As Long, iEnd As Long
  iStart = ActiveDocument.Range.End - Len(Selection.Range.Text)   'assumes typing replaces selection
  Selection.TypeParagraph     ' Word default action
  iEnd = ActiveDocument.Range.End
  If iStart <> iEnd - 1 Then
    MsgBox "No autotext insertion"
  Else
    MsgBox "Autotext insertion"
  End If
  
  ' Update fields, then show some tips in the status bar
'  Application.Run MacroName:="UpdateFields"
'  Application.Run MacroName:="SmartKeyHelp"
End Sub
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote