Macro creating class Module
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
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
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
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
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
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.
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.
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:
Note that MindManager integrates the WWB-COM version and not the WWB.NET implementation.
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:
Note that MindManager integrates the WWB-COM version and not the WWB.NET implementation.
Brillant . Thank you so much. I spent hours on this.
Brillant . Thank you so much. I spent hours on this.
---