jamieCR9
09-25-2009, 08:20 AM
Hey I am new to these forums. Can I ask, how do I code the following:Sub Msgbox_Yes_No()
Dim Response As Integer
' Displays a message box with the yes and no options.
Response = MsgBox(prompt:="Are you sure you want to continue with your choice? You can't go back after your choice.", Buttons:=vbYesNo)
' If statement to check if the yes button was selected.
If Response = vbYes Then
MsgBox "Proceed to build your laptop."
ActivePresentation.SlideShowWindow.View.Next
Else
' The no button was selected.
MsgBox "Please pick the other option"
End If
End Sub
under a command button? I tried to copy and paste the following code into the command button but came up with an error.
This is what I have been typing in:
Private Sub CommandButton1_Click()
Sub Msgbox_Yes_No()
Dim Response As Integer
' Displays a message box with the yes and no options.
Response = MsgBox(prompt:="Are you sure you want to continue with your choice? You can't go back after your choice.", Buttons:=vbYesNo)
' If statement to check if the yes button was selected.
If Response = vbYes Then
MsgBox "Proceed to build your laptop."
ActivePresentation.SlideShowWindow.View.Next
Else
' The no button was selected.
MsgBox "Please pick the other option"
End If
End Sub
End Sub
What do I need to fix? Thanks. :)
Dim Response As Integer
' Displays a message box with the yes and no options.
Response = MsgBox(prompt:="Are you sure you want to continue with your choice? You can't go back after your choice.", Buttons:=vbYesNo)
' If statement to check if the yes button was selected.
If Response = vbYes Then
MsgBox "Proceed to build your laptop."
ActivePresentation.SlideShowWindow.View.Next
Else
' The no button was selected.
MsgBox "Please pick the other option"
End If
End Sub
under a command button? I tried to copy and paste the following code into the command button but came up with an error.
This is what I have been typing in:
Private Sub CommandButton1_Click()
Sub Msgbox_Yes_No()
Dim Response As Integer
' Displays a message box with the yes and no options.
Response = MsgBox(prompt:="Are you sure you want to continue with your choice? You can't go back after your choice.", Buttons:=vbYesNo)
' If statement to check if the yes button was selected.
If Response = vbYes Then
MsgBox "Proceed to build your laptop."
ActivePresentation.SlideShowWindow.View.Next
Else
' The no button was selected.
MsgBox "Please pick the other option"
End If
End Sub
End Sub
What do I need to fix? Thanks. :)