Workbooks with Variable name

  • I am unable to work with Workbooks which name is based on a Variable

    Sub test2()
    Dim MyFile As String
    MyFile = "Justin Dashboard 2019"
    End Sub

    This gives me the error "Object doesn't support this property or method"

    Of course I need a dynamic variable which will be changed based on other variables etc... in the future.
    but for now, I am not even able to go further unless I put

    Workbooks("Justin Dashboard 2019").Active

    just without a variable.
    This is blocking my work

    Any help would be of big help!
    Thank you in advance


  • "Active"is causing the error, it is not a property of "Workbooks'. Try


    We now have a reputation system in place. If my reply helped please "Like" the reply by clicking the "Like" icon at bottom right of my reply.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!