I am struggling with a bit of VBa and Excel. I need to create a structure in VBa, which is Type. I have a problem, I get an error when I try to execute the code! I feel that I need to explain how I arrived where I am if I made a mistake.
I read that to create a type it needs to be made public. So I created a new class (in class modules). In Class1, I wrote
Public Type SpiderKeyPair
IsComplete As Boolean
Key As String
End Type
And inside ThisWorkbookI have the following
Public Sub Test()
Dim skp As SpiderKeyPair
skp.IsComplete = True
skp.Key = "abc"
End Sub
There is no other code. I have a problem: I get an error
Unable to define public user type inside object module
private, , , , - ( .NET).
Class1 Module1, , , - , .
Test
Private m_spiderKeys As Collection
Public Sub Test()
Dim sKey As SpiderKeyPair
sKey.IsComplete = False
sKey.Key = "abc"
m_spiderKeys.Add (sKey) 'FAILS HERE
End Sub
, ,
, , ... SpiderKeyPair ?