- Sub Procedures
- Creating Functions
- Using Optional Arguments
- Passing a Variable Number of Arguments
- Preserving Data Between Procedure Calls
- Understanding Scope
- Handling Runtime Errors
- Unstructured Exception Handling
- Structured Exception Handling
- Introducing Classes and Objects
How can I pass an array to a procedure?
Say you create an array like this: Dim Array(4) As Integer. Then you assign a value to one element like this: Array(1) = 1. Now you can pass the array to a function named TheFunction as follows: TheFunction(Array). The function is declared like this: Function TheFunction(ByVal PassedArray() As Integer) As Integer. And finally you can refer to the passed array using the name PassedArray as follows: Return PassedArray(1).
Can I mix structured and unstructured exception handling?
Only up to a point. You can't mix the On Error and Try/Catch statements, but you can, for example, access the Err.Number property in Catch blocks.