Variable declaration in programming involves declaring a variable name and its data type using the Dim keyword followed by the variable name, data type, and optionally multiple variables separated by commas. An input box allows getting user input at runtime by declaring a variable, then assigning the variable the value returned from an InputBox function along with a prompt string.