Depending on exactly what you mean by "End session", there is:
Exit Sub/Function - Stop execution the current routine
ThisWorkbook.Close - Close the current WB
Application.Quit - Close Excel
NickHK
"Freddie Mac" <FreddieMac@discussions.microsoft.com> wrote in message
news:9740CAD1-8713-4999-9268-E46CE5CC3C86@microsoft.com...
> I have a macro that does alot of things. Sometimes I want to call a sub
that
> ends the program for whatever reason. I dont know how to write this. My
code
> is:
>
> Private Sub avbrytProgrammet(varDataSaknas)
> MsgBox ("Error 402. Program session aborted.")
> Me.End
> End Sub
>
> The line is wrong. How do you write this?
Bookmarks