1

I have a msgbox in my code. I use F8 to check my code. When I get to the message box, it appears on the screen, I then click ok, but it doesn't move to the next line. If I will click F8 again it will start the function again.

What could be the reason?

After my code didn't work, I tried the simplest code (not mine, found on line):

Sub MsgBoxInformationIcon()
Dim result As Integer

result = MsgBox("Do you want to continue?", vbYesNo + vbQuestion)
If result = vbYes Then
    Debug.Print "yes"
Else: Debug.Print "no"
End If
End Sub

The debugger gets to the line of result. message box pops up, I click any of the options, the message box disappears and the yellow line in the debugger disappears, no errors. If I click F8 again the sub will start again. n

Hana
  • 89
  • 2
  • 7
  • 1
    I see the code now. Is "yes" or "no" printed in your "immediates" pane in VBE? The question was probably closed because there was no code and no way to answer or help without it. Things happen quick sometimes here on SO. We will vote to reopen. No biggie. – JNevill Jan 06 '20 at 14:39
  • no. As I mentioned, it doesn't move forward to the next line – Hana Jan 06 '20 at 14:41
  • 1
    I've run this on my own machine and I can't replicate your issue. When I click either "yes" or "no" it takes me to the `if` statement for me to `F8` once again. – JNevill Jan 06 '20 at 14:41
  • 3
    It's a long shot, but I wonder if the [file is corrupted](https://stackoverflow.com/questions/39964472/excel-vba-debugger-stops-without-error-or-warning)? Something definitely feels off. – JNevill Jan 06 '20 at 14:44
  • Thanks @JNevill. I tried to close and open the file. still behaves the same. Other than that I am not sure what can be checked. – Hana Jan 06 '20 at 14:50
  • 1
    Try closing all excel windows. Open a new workbook. Put the code above in a new module attached to that new workbook and test. – Scott Craner Jan 06 '20 at 14:51

0 Answers0