Skip to content

Module statement demo code throws errors in VBA 7.1.119, am I using a wrong version? #29764

@jdkolassa

Description

@jdkolassa

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions