When trying to insert text into a text box (a standard text box from the drawing toolbar) using VBA I sometimes get the error message "-2147417848 method 'Insert' of Object 'Characters' failed." The code is below:
Sub warningtext_OWN_ARREARS_NO_PROPERTY_ADD(textboxname)
startpoint = Len(Range("a1"
) + 2
ActiveSheet.Shapes(textboxname).Select
Selection.Characters(Start:=startpoint, Length:=1).Insert _
Chr(10) & "THIS TENANT HAS NO BOND, AND IS IN ARREARS. " & _
"THEY HAVE NO PROPERTY TO SEIZE, SO SHOULD BE EVICTED. IF THEY LEAVE TODAY, YOU WOULD LOSE " & _
Format(-1 * Range("h13"
, "$0.00"
& " PLUS ANY SHOP ACCOUNT." + Chr(10)
textboxname is a string with value "Text Box 4". All textboxes have this name.
This error occurred 3 times today, but I cannot get it to repeat at will by rerunning the code. startpoint is 15 for what it's worth.
Sub warningtext_OWN_ARREARS_NO_PROPERTY_ADD(textboxname)
startpoint = Len(Range("a1"
ActiveSheet.Shapes(textboxname).Select
Selection.Characters(Start:=startpoint, Length:=1).Insert _
Chr(10) & "THIS TENANT HAS NO BOND, AND IS IN ARREARS. " & _
"THEY HAVE NO PROPERTY TO SEIZE, SO SHOULD BE EVICTED. IF THEY LEAVE TODAY, YOU WOULD LOSE " & _
Format(-1 * Range("h13"
textboxname is a string with value "Text Box 4". All textboxes have this name.
This error occurred 3 times today, but I cannot get it to repeat at will by rerunning the code. startpoint is 15 for what it's worth.