Macro creating class Module

ablq89 shared this question 8 days ago
Discussion Open

Has any one created a class module with the editor. I cant ge the syntax correct.
'#Language "WWB-COM"

'#Uses "Simple.CLS"

Sub Main

Dim myObject As Object

Set myObject = New simple

'Set myObject = New Simple

' myObject.Value = 42

End Sub

VERSION 1.0 CLASS

BEGIN

MultiUse = -1 'True

END

Attribute VB_Name = "Class2"

'#Language "WWB-COM"

Option Explicit

Sub Test()

End Sub


Also tried syntax like

Class Simple

End Class

Still syntax errors

Replies (6)

photo
1

You have defined the class name as "Class2" (Edit -> Properties in a Class module) but in Sub Main you are creating an object called "simple". Try:

Set MyObject = New Class2

photo
1

I understand what you are saying. But could you give me an example of class module as I am just trying random parametess when creating it.
This is the bits I am copying from else where to try and get it to work. I am work a lot in VBA and excel so understand classes etc . It really straight forward. I just create a class and use in the module.
But In Mindmanger it seems you need extra stuff to declare the class module and use statements such #Use which I am not used too
VERSION 1.0 CLASS

BEGIN

MultiUse = -1 'True

END

Attribute VB_Name = "Class2"

'#Language "WWB-COM"

Option Explicit

photo
1

990916cc46aaf974b60086bed0e31f70

photo
1

Just getting constant errors just using the basic.. But I didn't know of edit properties of the name . That useful. But still not working.

photo
1

You are nearly there. You just need a line

'#Uses "clsSimple.cls"

at the top of TestclsSimple.mmbas. Then it will include the class module, assuming it is in the same folder as the .mmbas module. The '#Uses directive allows you to use common code in more than one module.

There is an example in the WWB Help file. In the macro editor click Help > Language Help, then search for class. Double-click on WWB-COM Class Definition to see an example:

dd4b581f9c5a04ec2b2f10f6f23e9078


Note that MindManager integrates the WWB-COM version and not the WWB.NET implementation.

photo
1

Brillant . Thank you so much. I spent hours on this.

3a8847445f51cb966567cd4fbf483d98

Leave a Comment
 
Attach a file