I understand that the question sounds silly (Const vs. Dynamic).

Is there any solution for this situation?

Let us say, I have UserformLogin and ModulePublic :


'This is the code in ModulePublic
Public Const Username As String = "TempUsername"
Public Const Password As String = "TempPassword"


Public Const DatabaseConnectionString As String = "Driver={........};server=.........;uid=" & Username & ";pwd=" & Password & ";"
If I don't have set temporary value to Username/Password, the ModulePublic cannot compile when opening the workbook.

But the problem is that, I have already used Public Const statement for Username/Password, then in UserformLogin, I am not able to pass textbox value to Username/Password.

How to find an alternative solution?

Thanks.