The text in the shape "TextBox 1" is "Work stack.<8Spaces>###Resource: Name1". I want to delete "###" from the above text using ppt vba. The text in the shape after the below statement gets executed is "Work stack. Resource: Name1".
MyPPT.Slides(1).Shapes("TextBox 1").TextFrame.TextRange.Find("###").Delete
It's deleting the spaces after the period but I want to keep those spaces i.e. the desired output is "Work stack.<8Spaces>Resource: Name1". Replace(FindWhat:="###", ReplaceWhat:=vbNullString) works really well but I wanted to check whether this is the default behavior of delete method or is it misbehaving or is there a way to change this behavior through ppt textbox properties or some other settings. Please share your thoughts.
This seems to be the intended behavior of
Delete
. When done manually the behavior is similar, i.e. if###
is selected in the textbox, āBackspace clears the leading white space. The behavior ofCut
is similar.Maybe use
Replace
with a blank string instead ofDelete
.