Microsoft Visual Basic Compile Error: Invalid Outside Procedures

C

cotigchez

I am trying to create a password prompt for my computer science class
powerpoint. Such that the students cannot continue on untill they type in
the correct password. The code I'm using is the following:

Private Sub CommandButton1_Click()

If TextBox1.Text = "password" Then SlideShowWindows(Index:=1).View.Next

Else
MsgBox "Try Again", 16, "Incorrect Password"
End If
TextBox1.Text = ""

End Sub

Private Sub CommandButton2_Click()

End Sub

Private Sub TextBox1_Change()

End Sub

When I run the PPT any time my cursor moves into a form text box, MS Visual
Basic opens and I get the following error "Microsoft Visual Basic Compile
Error: Invalid Outside Procedures" with the following code:

ActiveWindow.Selection.ShapeRange(1).Name = "test23"

Private Sub TextBox1_Change()

End Sub

I don't know what to do!?? Help please!
 
K

ker_01

Does the password need to stay visible on the slide? If not, then try:

PasswordAttempt = Inputbox("Please enter the password","Password Required")

If PasswordAttempt = "password" then ... (etc)

Two thoughts:
1) putting your password in VBA is extremely unreliable. Any student who
knows to hit <F11> can open the VBE and look for the password.
2) This will only work if your presentation is opened with macros enabled.
I'm assuming you probably are using kiosk mode with no navigation buttons on
this slide (or something equivalent) to prevent the user from advancing if
they don't type the password.
 
K

ker_01

Followup to my previous response: I can't tell from the info provided why you
would get that error just on entering a text box. Do you have other event
handlers for page activity, like TextBox1_Change?

Also, a suggestion: go in to design mode, and look at the properties for
your commandbuttons- change "take focus on click" to false for all of them.
I'm not sure how the focus affects the Powerpoint events, but it can really
mess things up in Excel under certain conditions.

HTH,
Keith
 
C

cotigchez

Commenting the line out worked!! Thank you so much. This problem has been
driving me crazy. Thanks again!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top