Mombu the Microsoft Forum

Go Back   Mombu the Microsoft Forum > Microsoft > How to initial Class
User Name
Password
REGISTER NOW! Mark Forums Read




Reply
1 17th October 17:41
moonhk
External User
 
Posts: 1
Default How to initial Class



Hi All

How to initial class to run initial procedure ?

class Account
dim Username
dim Usernamepassword
dim Domain
dim objshell
sub init
Set objshell = CreateObject("Wscript.shell")
Username = objshell.ExpandEnvironmentStrings("%me%")
Usernamepassword = objshell.ExpandEnvironmentStrings("%mepw%")
end class


set myAccount = new Account
myAccount.init() <= can able to skip this line ?

When set xxx = new Account , the auto run initial procedure
  Reply With Quote


 


2 17th October 17:41
al dunbar
External User
 
Posts: 1
Default How to initial Class



I'm a bit rusty, but I think all you need do is to create a sub with no
parameters named class_initialize, and it will be invoked whenever a new
instance is created.

/Al
  Reply With Quote
3 17th October 17:41
moonhk
External User
 
Posts: 1
Default How to initial Class


Thank. it works.
  Reply With Quote
Reply


Thread Tools
Display Modes




666