ActiveWorkbook.SaveAs(FileName As String) Some procedures especially some of the built-in methods can often contain a large number of parameters where in fact all these parameters are declared as optional.įor example Excel's Workbook.SaveAs method. You can also place the arguments in any order. Using named arguments remove the need for spaces for missing arguments. Note the special syntax for named arguments, and the colon before the equal sign. If you have a lot of optional arguments the procedure call can get very messing Improves the readability and clarity of your code. We can enter the arguments in any order and no not need to include extra unnecessary commas between the arguments we are not passing in.Īlso the code is better documented and easier to understand. There are some advantages to specifying parameters by name Used named arguments for methods that have lots of optional arguments and also when you only need to use a few. This is preferred since you don't need to include spaces for missing arguments and can place the arguments in any order This is the assignment of the parameter to the correct value.
0 Comments
Leave a Reply. |