I try to Set a constant which should contain the Connection String for my Database. But the Setup for my macro is so that on the first Sheet in my Excel there are a lot of Buttons. Depending on which Button the user clicks another Module gets executed, but all of them connect to the same DB at some point.
Since I don't want to change the Connection String at many different points it should be done with one Constant.
But I can never tell which Module gets executed an which doesn't.
Therefore I created a new Module which only contains one Line of Code:
Public Const ConnectionString As String = "Driver={MySQL ODBC 8.0 Unicode Driver};Server=localhost;Database=X;User=root;Password=X;"
Unfortunately when a Button is clicked and some Module/Sub gets executed, the Variable "ConnectionString" Contains no Value.
How can I make sure that independent of the called Sub/Module the Constant is set?