If you check out my history you will see that I have been calling Worksheets references through method calls. A working example of one such method:
'In module GlobalRefs
Function W_ExampleWS() As Worksheet
Set W_ExampleWS = ActiveWorkbook.Worksheets("ExampleWS")
End Function
So when I do normal worksheet related calls, they work:
...
GlobalRefs.W_ExamplesWS.Range("A1").Value = 42 'works
...
However, the worksheet ExampleWS has a subroutine called "DesignGraph". I want to be able to call that subroutine through a method call like so.
'In module AnotherRandomModule
...
GlobalRefs.W_ExampleWS.DesignGraph arg1 arg2
...
I keep receiving errors like the method is undefined even though the VBA Editor's intellisense acknowledges the the existence of the subroutine as it corrects the capitalization of DesignGraph if spelt mis-cased. I am giving it the correct arguments.
Why is this happening?
arg1andarg2?DesignGraph(and any other routines) as a method. This is a good approach if you want to model a specific worksheet "type", of which there could be many instances: it also avoids duplicating code in each instance of that type.