VBA – Trim

  • Post author:
  • Post category:VBA
  • Post comments:1 Comment
Trim function

The Trim function removes both the leading and the trailing blank spaces of the given input string.

Syntax

Trim(String)

Example

Add a button and add the following function.

Private Sub Constant_demo_Click()
   var = "Microsoft VBScript"
   var =       "            Microsoft VBScript           "
   msgbox ("After Trim : " & Trim(var))
End Sub

When you execute the above function, it produces the following output.

After trim : Microsoft VBScript

Previous Page:-Click Here

This Post Has One Comment

Leave a Reply