Word Document Properties


Part III: Expanding Your VBA Horizons



Download 8,82 Mb.
Pdf ko'rish
bet155/207
Sana16.03.2022
Hajmi8,82 Mb.
#496217
1   ...   151   152   153   154   155   156   157   158   ...   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 184


C++, or Visual C# — when you want to create special controls for your VBA
program.
Note that the 
Timer
class might not appear with VBA, but you can read
about it at 
http://msdn.microsoft.com/library/en-us/vbcon98/
html/vbcontimercontrol.asp
. This control is so incredibly useful that
you might want to download the version that appears at Programmers
Heaven (
http://www.programmersheaven.com/download/29614/
download.aspx
) even if VBA includes the standard 
Timer
control. The
Programmers Heaven version provides better control over the timing
interval and can provide long-term timing.
Using classes to improve your applications
VBA generally relies on a combination of classes and procedural code to create
an application. The previous chapters of this book have demonstrated that
you can create applications in VBA that rely entirely on procedural code, but
these applications are limited. In some cases, you must use objects to inter-
act with the host application. For example, when you want to interact with
the Ribbon in Word, you must use an object to do it. All of these objects rely
on classes that are built into the host application.
Once you begin seeing the power of classes, you can decide whether to
create classes of your own. There isn’t a right or wrong position to take on
using classes of your own, despite what you might hear other people say.
Many developers create complex VBA applications without ever building a
class. It’s a matter of personal preference.
The advantages of using classes are many. The biggest advantages, however,
are that classes hide details that you might not want to think about as you
create an application, and you can easily reuse class code to create other
classes. The biggest disadvantages of using classes are that you do pay a
small performance and resource penalty, and modifying applications with
classes can become complex. A developer can lose contact with the code
in the application and then have to relearn it when it comes time to make a
change.
Designing a Basic Class
Because a class is a blueprint for an object, you need to have some idea of
what you want to build. The best classes are ones that answer specific needs
that you have. A class requires a specific look and feel. VBA includes this look
and feel as part of the objects that it creates from the class.
185

Download 8,82 Mb.

Do'stlaringiz bilan baham:
1   ...   151   152   153   154   155   156   157   158   ...   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