Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / April 2008

Tip: Looking for answers? Try searching our database.

Why so much non-OOP syntax in VBA?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
baobob@my-deja.com - 28 Apr 2008 17:54 GMT
Excel 2002 VBA newbie Q:

Looking at just one object, there is a "UserForm.Hide" but seemingly
no "UserForm.Close" method. Examples in this newsgroup seem to use
"Unload UserForm". I mean, huh?

I sure see an awful lot of this non-OOP syntax thruout VBA. Does full-
blown VB rely on it as well?

If so, is there a good reason why one shouldn't consider this pre-
Columbian mishmash, well, pathetic?

Thanks.

***
Gary''s Student - 28 Apr 2008 18:15 GMT
If VBA were rational it would not be as much fun!
Signature

Gary''s Student - gsnu2007h

> Excel 2002 VBA newbie Q:
>
[quoted text clipped - 11 lines]
>
> ***
Jim Thomlinson - 28 Apr 2008 18:23 GMT
VB is not  a true OOP language. It does not even support inheritance. While
you can create classes OOP is more of an added on feature than an inherant
characteristic of the language.
Signature

HTH...

Jim Thomlinson

> Excel 2002 VBA newbie Q:
>
[quoted text clipped - 11 lines]
>
> ***
Zack Barresse - 28 Apr 2008 18:24 GMT
Well, not sure how good of an explanation this will be, but I can hit on
some of it.  The why's and wherefore's I probably can't though.  The
Load/Unload statements are for claiming and releasing objects from memory,
which is a *good* thing for managed code, well, more or less the basis for
managed code being "managed" (by the CLR:
http://en.wikipedia.org/wiki/Common_Language_Runtime).  VBA is an OOP
language.  In this specific instance you're referring to, you're using a
Statement which releases an Object.  This is opposed to having an Object and
using/setting Properties or Controls from that Object.  So while it may seem
that you are indeed controlling an Object (a UserForm in this case) you are,
but you are doing so from a Statement, which is not a control/property from
that particular Object, but the Object Model itself.

Does that make sense?  Probably not.  I'm sure there are other great minds
who could explain it much better than I.  VBA offers a full, rich OM.  Being
managed code and object oriented, there is much versatility that we have.
There is no substitute for knowing the OM though, and all code languages
have their own nuances and intricacies.  I'm not saying VBA is perfect, but
IMO it is a well-rounded language.  I wouldn't consider VBA pre-Columbian,
nor mishmash, and certainly not pathetic.  But it is, alas, in the eye of
the beholder.  <g>

HTH

Regards,
Zack Barresse
> Excel 2002 VBA newbie Q:
>
[quoted text clipped - 11 lines]
>
> ***
Jeff Johnson - 28 Apr 2008 19:36 GMT
> Excel 2002 VBA newbie Q:
>
[quoted text clipped - 4 lines]
> I sure see an awful lot of this non-OOP syntax thruout VBA. Does full-
> blown VB rely on it as well?

VB6 and earlier, yes. Welcome to the world of legacy and backwards
compatibility.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.