What version of VBA is this page for? I'm using VBA 7.1.119, and keep running into Compile error: Expected: end of statement whenever I try to run a module. I just copied the code from this page into a new module to test it, and I received the same error. I'm clearly missing something.
For reference, this is the specific code block I copied:
Public Module thisModule
Sub Main()
Dim userName As String = InputBox("What is your name?")
MsgBox ("User name is " & userName)
End Sub
' Insert variable, property, procedure, and event declarations.
End Module
Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.