I have a Sub in a regular Module where my code is mainly taking place. In a class module i have a sub, requiring Arguments which are not properties of the class module itself. Now i have trouble with getting the code started.
I made an example code with a minimum of lines, so you can see what i planned to do.
First the class module "clsCity":
Option Explicit
Public area As Single
'Public l As Single 'Working, but not desired solution:
'Public h As Single 'Working, but not desired solution:
Sub calcArea(length As Single, height As Single)
area = length * height
End Sub
Now the program itself:
Sub Country()
Dim BikiniBottom As New clsCity
Dim l As Single
Dim h As Single
Bikinibottom.calcArea(l,h) 'Error: "vba: Compile Error: expected: ="
'Working, but not desired solution:
'Bikinibottom.calcArea 'Where l and h are properties of clsCity
End Sub
As you can see, i plan to calculate the area of Bikinibottom with variables "l" and "h", which are not properties of clsCity. I get the error "vba: Compile Error: expected: =" when pressing enter. What do i do wrong? This is a sub and not a function, a "=" should not be necessary.
I know it would work to use the commented code. However, this is just a short example, please keep in mind that in my real code it is not a sophistic solution to make "l" and "h" a property of clsCity (they are properties of other class modules!)