library_vb » Revisions »
Differences
This shows you the differences between the selected revisions of the page.
2014-03-03 | 2014-08-04 | ||
key size should be 2048 bit at least nowadays (martin) | american spelling + typo (martin) | ||
Line 44: | Line 44: | ||
VBA does not support catching exceptions, what is a common way of handling errors in examples for most other languages. | VBA does not support catching exceptions, what is a common way of handling errors in examples for most other languages. | ||
- | In case you need to use custom error handling, instead of interrupting a VB macro (the default behaviour), use ''[[msdn>gg251688|On Error]]'' statement. | + | In case you need to use custom error handling, instead of interrupting a VB macro (the default behavior), use ''[[msdn>gg251688|On Error]]'' statement. |
Use ''On Error Resume Next'' to disable default error handling. Then you need to query ''[[msdn>gg251525|Err.Number]]'' after every statement to test for errors. You can revert to default error handling (aborting the macro) using ''On Error GoTo 0''. | Use ''On Error Resume Next'' to disable default error handling. Then you need to query ''[[msdn>gg251525|Err.Number]]'' after every statement to test for errors. You can revert to default error handling (aborting the macro) using ''On Error GoTo 0''. | ||
Line 71: | Line 71: | ||
</code> | </code> | ||
- | If you do not want to test for errors after every statement, you need to group the staments you want to guard into a subprocedure and enable custom error handling before calling/entering the subprocedure. | + | If you do not want to test for errors after every statement, you need to group the statements you want to guard into a subprocedure and enable custom error handling before calling/entering the subprocedure. |
This approach is also recommended to ensure that ''[[library_session_dispose|Session.Dispose]]'' is called even in case of error. | This approach is also recommended to ensure that ''[[library_session_dispose|Session.Dispose]]'' is called even in case of error. |