Word Document Properties


Figure 9-1: Use the Debugger  to see predefined collections. 220 Part III: Expanding Your VBA Horizons



Download 8,82 Mb.
Pdf ko'rish
bet183/207
Sana16.03.2022
Hajmi8,82 Mb.
#496217
1   ...   179   180   181   182   183   184   185   186   ...   207
Bog'liq
VBA For Dummies 5th Ed.pdf ( PDFDrive )

Figure 9-1:
Use the
Debugger 
to see
predefined
collections.
220
Part III: Expanding Your VBA Horizons 
15_046500 ch09.qxp 12/5/06 5:36 PM Page 220


Defining Your Own Data Types
A VBA 
user-defined data type
is nothing more than a list (collection) of data
elements that you want to use together. You aren’t really creating a new data
type — at least not one that you could identify as a unique entity, such as a
String
or an 
Integer
. In this section, I show how to benefit from user-
defined data types and demonstrate their use.
Understanding user-defined data types
Creating a user-defined type means defining the data that you want to use
together and deciding which native data types work best. The example in the
earlier “Adding keyed data to the collection” section uses a database connec-
tion to get hold of data and place it in a collection. The implementation (the
actual coding) in that example is difficult because you have to make three
entries in the collection for each database record. Here’s a user-defined type
that places all the information in one entry. (You can find the source code for
this example on the Dummies.com site at 
http://www.dummies.com/
go/vbafd5e
.)
‘ Define a user type.
Public Type APerson
Name As String ‘ The person’s name.
Telephone As String ‘ The contact telephone number.
LastContact As Date ‘ The date of last contact.
End Type
You create a user-defined type by using the 
Type
keyword followed by the
name of the new data type. The structure contains native data types. Each
Figure 9-2:
Browse 
for the
collections
that you
need to use
in your
program.
221

Download 8,82 Mb.

Do'stlaringiz bilan baham:
1   ...   179   180   181   182   183   184   185   186   ...   207




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©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