VBA Public Constant named "Password" loads as stars

Anonymous
2012-09-22T00:11:33+00:00

I have a vba module that contains a public constant called "Password" . I have been using the constant without any problems in my modules, but when I started using it in the workbook open event, it loads as "********" instead of its actual value. It only happens in the workbook open event and only when the constant is called "Password" I had to change the constant name to "Password1" to make it work. I am curious to know why Excel behaves this way. I have Excel 2010 32-bit on Win 7

Microsoft 365 and Office | Excel | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

3 answers

Sort by: Most helpful
  1. Anonymous
    2012-09-22T18:19:54+00:00

    Yes.

    That begs the question  "How do I expose both the Constant and the Property in the same module??"

    Easy for a standard module:

    Sub TheMarines()

    MsgBox "Make sure your password is " & Password

    MsgBox "for this workbook, the password is " & ActiveWorkbook.Password

    End Sub

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2012-09-22T17:31:19+00:00

    Thanks Garry's Student. But I did not qualify the "Password" property! Does Excel interpret as a Workbook property since it is used in the workbook events?

    Was this answer helpful?

    0 comments No comments
  3. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.


    Comments have been turned off. Learn more