Thread: [Solved] Help with VBA userform
View Single Post
 
Old 03-02-2015, 11:32 AM
JohnWilson JohnWilson is offline Windows 7 64bit Office 2010 32bit
Programmer
 
Join Date: Nov 2008
Location: UK
Posts: 1,914
JohnWilson has a spectacular aura aboutJohnWilson has a spectacular aura about
Default

Although you haven't declared the variable (and you should) PowerPoint will assume it to be declared in the Private sub. Because it is private to this sub only it cannot be used elsewhere.

Declare it like this
'Outside iof the private sub
Dim UserID As String

Private Sub TextBox1_Change()
UserID = TextBox1.Text
End Sub

Private Sub ToggleButton1_Click()
MsgBox ("Thank you," & UserID)
End Sub
Reply With Quote