I have made some code in Word VBA and at the end I need 1 backspace keytroke. How is this achievable?
The simplest solution is just:
Selection.TypeBackspace
The simple way to send a backspace (but not the most robust solution) :
SendKeys ("{BACKSPACE}")
A safer way to do this :
Selection.MoveLeft Extend:=wdExtend
Selection.Delete
If something is already selected, and you want to delete just the last character, preface the above by :
Selection.Collapse wdCollapseEnd
To go to the start of the current page :
ActiveDocument.GoTo(wdGoToPage, wdGoToRelative, 0).Select
You can do it this way if your text is in a string or text field:
dim strText as string
strText = yourdatasourcehere
strText = left(strText,len(strText) - 1)
youroutputsource = strText
This works for spaces too as they are counted with the len
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With