Global iSession as Integer ' declare as global as all functions ' will use it as a parameter … 'Get Session ID iSession = LceGetSessionId() If iSession = 0 Then MsgBox "No Session ID" End ' nothing you can do End If