Skip to Main Content

VBA Tip: Trim Text Input

Written by Rod Wing.

 

The Trim$ function removes any leading or trailing space characters from a string.

' returns "abc"
strValue = Trim$ ("     abc     ")

Use the Trim$ function on all user entered text input. It is very easy for the user to enter a hidden space at the beginning or ending of a text field on a user form. Trimming all text inputs can eliminate a lot of frustrations in tracking down why your macro isn’t working properly.

Last Month’s Tips:


3d civil content for microstation visualization   Screenshot   1           exterminator

MicroStation: 3D Civil             InRoads: GEOPAK                   AutoCAD Civil 3D 2014:          VBA: Debug
for MicroStation Vis…            Corridor Modeling Cr…          Adding Extended Data to…   

 

Leave a Reply

Your email address will not be published. Required fields are marked *