I'm trying to convert some python scripts to VBA and haven't been able to find an equivalent to the underscore method to ignore a return variable from a function I don't want to use.
In python I would do:
[_, MyName, ret] = ETABSModel.PierLabel.GetNameList()
The equivalent statement in VBA is:
ret = ETABSModel.PierLabel.GetNameList(NumberNames, MyName())
How can I ignore the return variable NumberNames in this case?
Thanks!
You can call a VBA
functionexactly like asub. If you are familiar with other programming languages, you can see asublike a void function - a function that doesn't return anything.Basically, there are three ways to call a routine in VBA. The first is valid only for functions:
The second and third are valid for Subs and Functions. Both are equivalent, it's just a matter of taste. It is sometimes claimed that using
Callis deprecated, however, I can't find such statement from Microsoft.Note that the following syntax is invalid. Either use Call or omit the parenthesis.
If you have a sub or function that takes only 1 parameter, the following syntax is valid, however, the parenthesis have a complete different meaning: It will evaluate the value of the parameter and put it on the stack. This will prevent that the value of a parameter that is called by reference is modified by the routine. You can safely assume that in 99% this is done unintentionally.
The VBA editor shows it by adding a space between the routine name and the parameter:
Using the same syntax for 2 parameters makes it more obvious: bar (2), (4)