me.close() not closing

Can anyone suggest why the me.close() method does nothing in the following example (actual code pasted and some of the junk removed for clarity).

I can step through it in break mode and the instruction "executes" but nothing happens and execution continues after the End if!

If I put another command after the me.close e.g. a msgbox - that command executes properly!

Rich

answer = MsgBox("This ..... )

If answer = MsgBoxResult.Cancel Then

Me.Close()

Else

(More code)

End If



Answer this question

me.close() not closing

  • DonRajah

    Thank you Frank. It works but I find it bizarre.

    Presumably then, "me.close" means close the visual representation of the form but continue running code even if there is no window to display the results on. Then, if we hit an exit sub/function, don't return to the calling line but stop. So you can, in effect, ask the me.close method to take effect at some unknown point in the future when you hit an 'exit' command.

    Is it me, or is this strange

    Cheers,

    Rich


  • Nfrf

    Code will continue to execute in the routine after the Me.Close. This statement does not exit the currently executing routine. If you want to exit the routine, add an Exit Function (or Sub) right after the Me.Close.

  • me.close() not closing