Is there anyway to replace text in a textbox for example see below. I am currently using this, but does not seem to work well in VBA.
If TextBox6.Text.Contains("<GTOL-PERP>") Then
TextBox6.Text = TextBox6.Text.Replace("<GTOL-PERP>", "j")
End If
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
.Text is a string property in VBA. Strings are not objects in VBA so you’ll need to use string functions rather than methods when dealing with them. See below:
A List of String Functions in VBA
EDIT You can actually skip the IF since replace() doesn’t throw an error if the text isn’t in the string.