I have a strange problem defining a class in an Excel VBA macro.
To do this I go to Excel→DEVELOPER(tab)→Visual Basic (the new view is opened). In this new view I do Project Name→Insert→Class Module and a new file is created.
Then I try to create a simple class in this file, like:
Class VirtualWindow
Public Sub Class_Initialize()
Debug.Print "Class_Initialize"
End Sub
Public Sub Class_Terminate()
Debug.Print "Class_Terminate"
End Sub
End Class
End Class
is in red color, this meaning that it's not ok and when I try running it to see what error it throws it gives me the "Invalid outside procedure" error. I don't understand where is the problem.