Re: Mit Unterprozedur Hauptprozedur beenden?

From: Frank Arendt-Theilen (no email)
Date: 10/21/04


Date: Thu, 21 Oct 2004 18:42:43 +0200

Hallo Andre,
eine Möglichkeit:
deklariere eine globale boolsche Variable, die auf False gesetzt
bleibt solange kein Fehler auftritt und den Wert True zugewiesen
bekommt falls ein Fehler auftritt.
Als nächste Anweisung, unter der Verzweigungsanweisung zur Subroutine,
wird diese Varibale abgefragt und daraufhin die Hauptroutine
entsprechend weiter abgearbeitet oder beendet.

Dim booFehler as Boolean

Sub Hauptroutine()
  'dein Code
  '...
  Call Subroutine
  If booFehler Then Exit Sub
  'dein weiterer Code
  '...
End Sub

Sub Subroutine()
  On Error Goto Errorhandler
  'dein Code
  '...
  Exit Sub
ErrorHandler:
  booFehler = True
End Sub

MfG Frank
_____________________________________________
Frank Arendt-Theilen, Microsoft MVP für Excel, Hameln
Website: http://www.xl-faq.de; Auftragsprogrammierung



Relevant Pages

  • Re: Memory problem with XML::DOM::Parser???
    ... >> # Die Anfrage ist Teil der neuen EPA ... # Modul für die XML-Funktionen des Clients ... # Subroutine, um die XML-Struktur aus dem XML-Rootfile und den ... sub construct_xml { ...
    (comp.lang.perl.misc)
  • Re: passing database data to a sub
    ... > I'm not sure of the difference, why isn't it a subroutine? ... > sure about this 'shift' thing anyway :-) ... > sub teardown ... > # Setup the template to use for the output. ...
    (perl.beginners)
  • Re: Shared Method Problem With "Global" Storage
    ... Shared Method Problem With "Global" Storage ... declare the Sub as Shared. ... What I don't get is that if I refer to ButtonHasBeenClicked in a subroutine ... code which is unique to mining web site B. ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Proper class setup?
    ... > sub init { ... here: AUTOLOAD and lvalue subroutines. ... if a subroutine named AUTOLOAD exists then it will be called whenever ...
    (perl.beginners)
  • Re: VB app nolonger works with XP SP2
    ... >> Public Sub New ... >> Private components As System.ComponentModel.IContainer ... >> ' This enumeration provides values for the lines sent to the Comm Port ... >> ' This subroutine invokes a thread to perform an asynchronous write. ...
    (microsoft.public.dotnet.languages.vb)