About Requesting for a String (VBA/ActiveX)

The GetString method prompts the user for input of a string at the AutoCAD Command prompt.

This method accepts two parameters. The first parameter controls the input of spaces in the input string. If it is set to 0, spaces are not allowed (Spacebar terminates the input); if set to 1, the string can contain spaces (Enter must be used to terminate the input). The second parameter is the prompt string.

Get a string value from the user at the AutoCAD Command prompt

The following example displays the Enter Your Name prompt, and requires that the input from the user be terminated by pressing Enter (spaces are allowed in the input string). The string value is stored in the retVal variable and is displayed using a message box.

Sub Ch3_GetStringFromUser()
  Dim retVal As String
  retVal = ThisDrawing.Utility.GetString(1, vbCrLf & "Enter your name: ")
  MsgBox "The name entered was: " & retVal
End Sub

The GetString method does not honor a prior call to the InitializeUserInput method.