PC Review


Reply
Thread Tools Rate Thread

Class module constructors

 
 
=?Utf-8?B?dml2bWFoYQ==?=
Guest
Posts: n/a
 
      1st Jun 2007
How do i make a constructor in VBA?
I search one the web and help for 'constructor' but found nothing.

Thanks.
 
Reply With Quote
 
 
 
 
JE McGimpsey
Guest
Posts: n/a
 
      1st Jun 2007
In the class module use the object_Initialize event, e.g.:

Private Sub Class_Initialize()
'Do something
End Sub

In article <D17785BC-4B07-438A-B65D-(E-Mail Removed)>,
vivmaha <(E-Mail Removed)> wrote:

> How do i make a constructor in VBA?
> I search one the web and help for 'constructor' but found nothing.
>
> Thanks.

 
Reply With Quote
 
=?Utf-8?B?dml2bWFoYQ==?=
Guest
Posts: n/a
 
      25th Jun 2007
Hi, this did not work.

Thanks.

"JE McGimpsey" wrote:

> In the class module use the object_Initialize event, e.g.:
>
> Private Sub Class_Initialize()
> 'Do something
> End Sub
>
> In article <D17785BC-4B07-438A-B65D-(E-Mail Removed)>,
> vivmaha <(E-Mail Removed)> wrote:
>
> > How do i make a constructor in VBA?
> > I search one the web and help for 'constructor' but found nothing.
> >
> > Thanks.

>

 
Reply With Quote
 
Chip Pearson
Guest
Posts: n/a
 
      25th Jun 2007
What does "did not work" mean? The Class_Initialize procedure is within the
class module and is automatically called when an instance of the class is
created. VBA does not allow for alternate constructors.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting
www.cpearson.com
(email on the web site)


"vivmaha" <(E-Mail Removed)> wrote in message
news:0129ADC7-9963-4C26-A0BB-(E-Mail Removed)...
> Hi, this did not work.
>
> Thanks.
>
> "JE McGimpsey" wrote:
>
>> In the class module use the object_Initialize event, e.g.:
>>
>> Private Sub Class_Initialize()
>> 'Do something
>> End Sub
>>
>> In article <D17785BC-4B07-438A-B65D-(E-Mail Removed)>,
>> vivmaha <(E-Mail Removed)> wrote:
>>
>> > How do i make a constructor in VBA?
>> > I search one the web and help for 'constructor' but found nothing.
>> >
>> > Thanks.

>>


 
Reply With Quote
 
=?Utf-8?B?dml2bWFoYQ==?=
Guest
Posts: n/a
 
      25th Jun 2007
Sorry.

When he said "Class_Initialize" i assumed I had to put the class name where
"class" was.

I put "Class_Initialize" and it worked.

Thanks.

Also, is there a destructor in VBA?

"Chip Pearson" wrote:

> What does "did not work" mean? The Class_Initialize procedure is within the
> class module and is automatically called when an instance of the class is
> created. VBA does not allow for alternate constructors.
>
>
> --
> Cordially,
> Chip Pearson
> Microsoft MVP - Excel
> Pearson Software Consulting
> www.cpearson.com
> (email on the web site)
>
>
> "vivmaha" <(E-Mail Removed)> wrote in message
> news:0129ADC7-9963-4C26-A0BB-(E-Mail Removed)...
> > Hi, this did not work.
> >
> > Thanks.
> >
> > "JE McGimpsey" wrote:
> >
> >> In the class module use the object_Initialize event, e.g.:
> >>
> >> Private Sub Class_Initialize()
> >> 'Do something
> >> End Sub
> >>
> >> In article <D17785BC-4B07-438A-B65D-(E-Mail Removed)>,
> >> vivmaha <(E-Mail Removed)> wrote:
> >>
> >> > How do i make a constructor in VBA?
> >> > I search one the web and help for 'constructor' but found nothing.
> >> >
> >> > Thanks.
> >>

>

 
Reply With Quote
 
Chip Pearson
Guest
Posts: n/a
 
      25th Jun 2007
> Also, is there a destructor in VBA?

The Terminate method is called when the class is destroyed.

Private Sub Class_Terminate()
' your code here
End Sub


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting
www.cpearson.com
(email on the web site)


"vivmaha" <(E-Mail Removed)> wrote in message
newsF950671-3CC7-4416-A0F2-(E-Mail Removed)...
> Sorry.
>
> When he said "Class_Initialize" i assumed I had to put the class name
> where
> "class" was.
>
> I put "Class_Initialize" and it worked.
>
> Thanks.
>
> Also, is there a destructor in VBA?
>
> "Chip Pearson" wrote:
>
>> What does "did not work" mean? The Class_Initialize procedure is within
>> the
>> class module and is automatically called when an instance of the class is
>> created. VBA does not allow for alternate constructors.
>>
>>
>> --
>> Cordially,
>> Chip Pearson
>> Microsoft MVP - Excel
>> Pearson Software Consulting
>> www.cpearson.com
>> (email on the web site)
>>
>>
>> "vivmaha" <(E-Mail Removed)> wrote in message
>> news:0129ADC7-9963-4C26-A0BB-(E-Mail Removed)...
>> > Hi, this did not work.
>> >
>> > Thanks.
>> >
>> > "JE McGimpsey" wrote:
>> >
>> >> In the class module use the object_Initialize event, e.g.:
>> >>
>> >> Private Sub Class_Initialize()
>> >> 'Do something
>> >> End Sub
>> >>
>> >> In article <D17785BC-4B07-438A-B65D-(E-Mail Removed)>,
>> >> vivmaha <(E-Mail Removed)> wrote:
>> >>
>> >> > How do i make a constructor in VBA?
>> >> > I search one the web and help for 'constructor' but found nothing.
>> >> >
>> >> > Thanks.
>> >>

>>


 
Reply With Quote
 
=?Utf-8?B?dml2bWFoYQ==?=
Guest
Posts: n/a
 
      25th Jun 2007
great.

thanks.

"Chip Pearson" wrote:

> > Also, is there a destructor in VBA?

>
> The Terminate method is called when the class is destroyed.
>
> Private Sub Class_Terminate()
> ' your code here
> End Sub
>
>
> --
> Cordially,
> Chip Pearson
> Microsoft MVP - Excel
> Pearson Software Consulting
> www.cpearson.com
> (email on the web site)
>
>
> "vivmaha" <(E-Mail Removed)> wrote in message
> newsF950671-3CC7-4416-A0F2-(E-Mail Removed)...
> > Sorry.
> >
> > When he said "Class_Initialize" i assumed I had to put the class name
> > where
> > "class" was.
> >
> > I put "Class_Initialize" and it worked.
> >
> > Thanks.
> >
> > Also, is there a destructor in VBA?
> >
> > "Chip Pearson" wrote:
> >
> >> What does "did not work" mean? The Class_Initialize procedure is within
> >> the
> >> class module and is automatically called when an instance of the class is
> >> created. VBA does not allow for alternate constructors.
> >>
> >>
> >> --
> >> Cordially,
> >> Chip Pearson
> >> Microsoft MVP - Excel
> >> Pearson Software Consulting
> >> www.cpearson.com
> >> (email on the web site)
> >>
> >>
> >> "vivmaha" <(E-Mail Removed)> wrote in message
> >> news:0129ADC7-9963-4C26-A0BB-(E-Mail Removed)...
> >> > Hi, this did not work.
> >> >
> >> > Thanks.
> >> >
> >> > "JE McGimpsey" wrote:
> >> >
> >> >> In the class module use the object_Initialize event, e.g.:
> >> >>
> >> >> Private Sub Class_Initialize()
> >> >> 'Do something
> >> >> End Sub
> >> >>
> >> >> In article <D17785BC-4B07-438A-B65D-(E-Mail Removed)>,
> >> >> vivmaha <(E-Mail Removed)> wrote:
> >> >>
> >> >> > How do i make a constructor in VBA?
> >> >> > I search one the web and help for 'constructor' but found nothing.
> >> >> >
> >> >> > Thanks.
> >> >>
> >>

>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Constructors in a Static Class Marc Gravell Microsoft C# .NET 0 28th Jul 2006 05:27 PM
Class Constructors =?Utf-8?B?U2FtdWRyYQ==?= Microsoft Dot NET Framework 8 29th Apr 2006 02:11 PM
inheriting from a class with constructors =?Utf-8?B?Ry4gUHVyYnk=?= Microsoft C# .NET 3 29th Mar 2005 05:49 AM
Class constructors Mujtaba Syed Microsoft C# .NET 2 5th Nov 2004 03:16 PM
Want to take the path of specific overloaded constructors from derived class up to just one below the base class. hazz Microsoft C# .NET 3 15th Aug 2004 01:59 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:19 AM.