I've got some VBA code to copy and paste in word. Using a button and the click event, this code works wonderfully. Using a textbox and the lostfocus event, the code errors out at Selection.HomeKey saying "Method 'HomeKey' of object 'Selection' failed". When I comment out Selection.Homekey, the .Execute fails with "The command is not available". I'm sure this is simple, but this is my first time with Word VBA. What am I missing? Thanks for the advice.
Me.Activate
Selection.HomeKey
With Selection.Find
.Forward = True
.Wrap = wdFindStop
.Text = "#simon#"
.Execute
End With
Me.Activate
Selection.HomeKey
With Selection.Find
.Forward = True
.Wrap = wdFindStop
.Text = "#simon#"
.Execute
End With