ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Problem with Type in a class module... (https://www.excelbanter.com/excel-programming/384134-problem-type-class-module.html)

darlove

Problem with Type in a class module...
 
Hi.

This is an excerpt from the Help files:

"In standard modules and class modules,
user-defined types are public by default.
This visibility can be changed using the
Private keyword."

This is very curious (and mysterious?)
because I want to declare a public
type in a class module and the VBE
protests. Anybody in the know?

Darek


merjet

Problem with Type in a class module...
 
I'd say the Help document errs.

Why do you want a public user-defined type in a class module? Any
element of a private user-defined type could be "made public" via
public Property Let and Property Get statements of the class.

Hth,
Merjet


Peter T

Problem with Type in a class module...
 
Indeed help is misleading, but no can do. It makes sense, your own UD type
in a class module would cause serious compile problems when used elsewhere
until an instance of your class exists, not to mention the possibility of
multiple instances of the same class.

Same goes for public constants and declares. However I've never quite
understood why a normal array can't be public in a class.

Regards,
Peter T


"darlove" wrote in message
oups.com...
Hi.

This is an excerpt from the Help files:

"In standard modules and class modules,
user-defined types are public by default.
This visibility can be changed using the
Private keyword."

This is very curious (and mysterious?)
because I want to declare a public
type in a class module and the VBE
protests. Anybody in the know?

Darek





All times are GMT +1. The time now is 02:28 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com