Posted By

Ideandro on 03/08/11


Tagged

errors function sub vbscript


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

Ideandro


Nuova funzione con gestione errori


 / Published in: Visual Basic
 

Per creare una nuova funzione completa di un gestore errori.

  1. '+///////////////////////////////////////////////////////////////////+
  2. '+===================================================================+
  3. Public Sub GestoreErrori(err_Errori As Errors)
  4. '+===================================================================+
  5. ' DESCRIZIONE:
  6. ' ARGOMENTI:
  7. ' RITORNA:
  8. '+===================================================================+
  9. ' ___________________________________________________________________
  10. '|> VARIABILI LOCALI
  11.  
  12. Dim str_Errore As String
  13. Dim err_ErrCiclo As Error
  14.  
  15. ' ___________________________________________________________________
  16. '|> Elenca l'insieme Errors e visualizza le proprietà
  17. '|> di ogni oggetto Error
  18.  
  19. For Each err_ErrCiclo In err_Errori
  20. With err_ErrCiclo
  21. str_Errore = _
  22. "Errore #" & .Number & vbCr & vbCr & _
  23. " " & .Description & vbCr & _
  24. " (Origine: " & .Source & ")" & vbCr & vbCr & _
  25. "Premere F1 per consultare l'argomento " & .HelpContext & vbCr & _
  26. " nel file " & .HelpFile & "."
  27. End With
  28. MsgBox str_Errore, vbApplicationModal + vbCritical + vbOKOnly, cnt_TitoloMsg & ": errore"
  29. Next
  30.  
  31. Err.Clear
  32.  
  33. End Sub
  34. '+===================================================================+
  35. '+\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\+
  36.  
  37. '+///////////////////////////////////////////////////////////////////+
  38. '+===================================================================+
  39. Function NuovaFunzione()
  40. '+===================================================================+
  41. ' DESCRIZIONE:
  42. ' ARGOMENTI:
  43. ' RITORNA:
  44. '+===================================================================+
  45. ' ___________________________________________________________________
  46. '|> ABILITO GESTIONE UTENTE DEGLI ERRORI
  47.  
  48. On Error GoTo Errors_Handler
  49.  
  50. ' ___________________________________________________________________
  51. '|> VARIABILI LOCALI
  52.  
  53.  
  54. ' ___________________________________________________________________
  55. '|> Istruzioni
  56.  
  57.  
  58.  
  59. ' ___________________________________________________________________
  60. '|> ESCO DALLA ROUTINE
  61.  
  62. Exit_Routine:
  63. Exit Function
  64.  
  65. ' ___________________________________________________________________
  66. '|> GESTISCO GLI ERRORI
  67.  
  68. Errors_Handler:
  69. Call GestoreErrori(Errors)
  70. Resume Exit_Routine
  71.  
  72. End Function
  73. '+===================================================================+
  74. '+\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\+

Report this snippet  

You need to login to post a comment.