PDA

View Full Version : Crash when exiting presentation show



Daniel2001
02-26-2009, 02:02 AM
Hi Everyone,
I have a strange problem with my power point vba. I place two
command buttons on first slide. One is called "input box"; it prompts
a pop-up box (created by UserForm) where users can input some data.
Another button is called "remove button"; this one is used to remove/
hide both two buttons, so user can click this button after they input
the data and both buttons shall disappear.It will become a clean
presentation.

Both command buttons work just fine. The problem is that Power point
crashes when user exit the show. I mean when you press "Esc" to exit
the show, sometimes Power point just crashes, not always, sometimes it
is ok.

Why this? I will put my VBA code here
* this code is for "remove button" */
Private Sub cmdRemove_Click()

With ActivePresentation.Slides(1)
.Shapes(1).Visible = msoFalse
.Shapes(2).Visible = msoFalse
End With
End Sub

/* this code is for "input box" */
Private Sub cmdInput_Click()
inputForm.Show
End Sub
/*The UserForm is very simple ,only one Textbox for inputing bankname
*/
Private Sub cbnCancel_Click()
inputForm.hide
End Sub

Private Sub cbnOK_Click()

ActivePresentation.Slides(2).Shapes("Name").TextFrame.TextRange.Text =
inputForm.tbxName

inputForm.hide

End Sub

Private Sub cbnReSet_Click()

ActivePresentation.Slides(2).Shapes
("Name").TextFrame.TextRange.Text = "Bank Navn"

End Sub

Private Sub UserForm_Initialize()
ActivePresentation.Slides(2).Shapes
("Name").TextFrame.TextRange.Text = "Bank Navn"
End Sub

Private Sub UserForm_Terminate()
inputForm.hide
End Sub
Thanks in advance!

Vincent