library_vb » Revisions »
Differences
This shows you the differences between the selected revisions of the page.
2012-03-23 | 2012-03-24 | ||
in vba, it's macro, not script (martin) | msdn interwiki (martin) | ||
Line 21: | Line 21: | ||
* Implement your interactions with WinSCP .NET assembly in a class module; | * Implement your interactions with WinSCP .NET assembly in a class module; | ||
* Declare private variable in your class module referring to ''[[library_session|Session]]'' class; | * Declare private variable in your class module referring to ''[[library_session|Session]]'' class; | ||
- | * Use ''[[http://msdn.microsoft.com/en-us/library/gg251653.aspx|WithEvents]]'' keyword, when declaring the private variable; | + | * Use ''[[msdn>gg251653|WithEvents]]'' keyword, when declaring the private variable; |
* Define private function (method) with name ''<variablename>_<event>'' and two arguments (e.g. ''sender'' and ''e'') for every event you need to handle. | * Define private function (method) with name ''<variablename>_<event>'' and two arguments (e.g. ''sender'' and ''e'') for every event you need to handle. | ||
Line 45: | Line 45: | ||
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 ''[[http://msdn.microsoft.com/en-us/library/gg251688.aspx|On Error]]'' statement. | + | In case you need to use custom error handling, instead of interrupting a VB macro (the default behaviour), use ''[[msdn>gg251688|On Error]]'' statement. |
- | Use ''On Error Resume Next'' to disable default error handling. Then you need to query ''[[http://msdn.microsoft.com/en-us/library/gg251525.aspx|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''. |
<code vb> | <code vb> |