VBA - UCase



The UCase function returns the string after converting the entered string into UPPER case letters.

Syntax

UCase(String)

Example

Add a button and place the following function inside the same.

Private Sub Constant_demo_Click()
   var = "Microsoft VBScript"
   msgbox("Line 1 : " & UCase(var))
   
   var = "MS VBSCRIPT"
   msgbox("Line 2 : " & UCase(var))
   
   var = "microsoft"
   msgbox("Line 3 : " & UCase(var))
End Sub

Upon executing the above script, it produces the following output.

Line 1 : MICROSOFT VBSCRIPT
Line 2 : MS VBSCRIPT
Line 3 : MICROSOFT
vba_strings.htm
Advertisements