Hi everyone,
I have a UserForm that runs when my excel project starts that prompts the user for two pieces of data: a username and a password (these are not for logging into the file itself, I need to use them to call web queries later). I want the UserForm to store both of these data in global variables, so that macros that are run in the future can refer to them and read their values. Unfortunately, I am very new to VBA and I cannot figure out what code I need and where exactly I need to put it. Here is my current code, where "authentication" is the name of the UserForm object, and the textboxes I use for entry are named "user" and "pass":
In "This Workbook"
Private Sub Workbook_Open()
authentication.Show
End Sub
In "authentication"
Private Sub submit_Click()
' Put a bunch of labels on cells
globalVarUsername = user
GlobalVarPassword = pass
authentication.Hide
End Sub
Bookmarks