Question

I am adding to a rather large workbook, with many sheets and macros, unfortunately they are not my domain to change... these include a module called Control, a sheet in the spreadsheet called Control and another sub in a different module using "Dim Control As Object" and then "Set Control = Worksheets(CONTROL_SHEET)"

My problem is I need to use "Dim chb As Control" but when my module is called I get the error:

Compile error: A module is not a valid type

Is there a way to define which Control I'm using in the Dim statement e.g. "Dim chb As Vartype.Control" ?

Was it helpful?

Solution

I think you should be able to specify it using MSForms as the root:

Public Sub test()
Dim x As MSForms.Control
End Sub
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top