Nested classes in VBA

J

Jeff

Hello all,
I'm trying to devolpe my own class for Office applications. I have a
questions about nested classes in VBA.. are they possible?
heres an example of what I mean:
Class File()
Class Open(FilePath as string)

end class
end class

so I would call if with:
MyClass.File.Open(FilePath)

The most I can accomplish is the base class with properties and methods, but
no nested classes. However excel itself uses then (i.e.
cell.interior.color...)

What am I doing wrong here, or is it just not possible in VBA?
Thanks, Jeff
 
K

Karl E. Peterson

Jeff said:
Hello all,
I'm trying to devolpe my own class for Office applications. I have a
questions about nested classes in VBA.. are they possible?
heres an example of what I mean:
Class File()
Class Open(FilePath as string)

end class
end class

so I would call if with:
MyClass.File.Open(FilePath)

The most I can accomplish is the base class with properties and
methods, but no nested classes. However excel itself uses then (i.e.
cell.interior.color...)

What am I doing wrong here, or is it just not possible in VBA?

In Classic VB/A, you implement such things with devices such as this:

Public Property Get SubClass() As MySubClass

You can see examples of this in either of these:

http://vb.mvps.org/samples/ClipEx
http://vb.mvps.org/samples/PrnInfo

The "nested" classes are distinct physical entities, stored in their own files.

Later... Karl
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top