Word Document Properties


Part III: Expanding Your VBA Horizons



Download 8,82 Mb.
Pdf ko'rish
bet166/207
Sana16.03.2022
Hajmi8,82 Mb.
#496217
1   ...   162   163   164   165   166   167   168   169   ...   207
Bog'liq
VBA For Dummies 5th Ed.pdf ( PDFDrive )

Part III: Expanding Your VBA Horizons 
14_046500 ch08.qxp 12/5/06 5:36 PM Page 196


Setting the Instancing property
You can create two kinds of classes for your program: private and public. The
default setting is private, which means that no one outside the program can
see the class or create objects from it. When you create a class that’s so spe-
cial that there’s no chance that you can use it outside the current program,
this is the setting that you should use.
You’ll use most of the classes that you create in multiple programs. You should
set the 
Instancing
property of these classes to 
Public
. Figure 8-1 shows
the 
Instancing
property in the Properties window.
The not-creatable portion of this property value means that other VBA pro-
grams can use objects contained within your class, but only if your class 
creates them. In the case of the example, this means that other programs
can use the 
SpecialIcon
object, but they can’t create the 
SpecialIcon
object directly. The 
SpecialMsg
class must create the 
SpecialIcon
object,
and then the caller can assign a value to that object.
Creating useful classes
You might wonder why a class that encapsulates the 
MsgBox
function would
be useful. This class is useful for a number of reasons. The most important is
that it makes using the 
MsgBox
function less of a memory teaser. The 
MsgBox
function provides a wealth of style options, but trying to memorize them all
is a waste of time. Creating a class that eliminates the memory gymnastics for
you saves time and effort.
Using the class also reduces the chance of error. Each property provides
access to mutually exclusive styles. You can combine multiple icon types
when using the 
MsgBox
function like this:
MsgBox “Hello”, vbCritical Or vbInformation

Download 8,82 Mb.

Do'stlaringiz bilan baham:
1   ...   162   163   164   165   166   167   168   169   ...   207




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©www.hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish