Setting Global Variables in VBA
- by dennis96411
I'm currently making an "OS" in PowerPoint and I need to know how to set global variables for the settings.
I made a module called "Settings" containing:
Public Sub Settings()
Option Explicit
Public UserName, UserIcon, Background, BrowserHomePage As String
Public SetupComplete As Boolean
SetupComplete = False
UserName = "Administrator"
UserIcon = Nothing
Background = Nothing
BrowserHomePage = Nothing
'Set the variables
UserName.Text = UserName
End Sub
Now on the "log in" screen, I have a text box named "UserName". I then made a button just to test out the variables. The button does this:
Private Sub CommandButton1_Click()
UserName.Value = UserName
End Sub
The text box has no value when I click the button. I'm super new at VBA, and would like to know how to do this. Also, if anyone knows how to automatically execute codes when starting the PowerPoint, that would be fantastic.