Word Document Properties


Figure 3-9: A single program can span more than one project. 68 Part II: Learning the Ropes



Download 8,82 Mb.
Pdf ko'rish
bet68/207
Sana16.03.2022
Hajmi8,82 Mb.
#496217
1   ...   64   65   66   67   68   69   70   71   ...   207
Bog'liq
VBA For Dummies 5th Ed.pdf ( PDFDrive )

Figure 3-9:
A single
program
can span
more than
one project.
68
Part II: Learning the Ropes 
08_046500 ch03.qxp 12/5/06 5:34 PM Page 68


functions in the Letter template as well as generic utility sub-procedures 
and functions in the Normal template. You can see this example in Chapter 13.
You might run into some situations like this when you create your Word 
programs, too.
Another situation in which you use multiple projects is when you create pro-
grams in which multiple applications have to work together. I have a program
for Word that asks CorelDRAW to import a drawing and convert it into a form
that Word can use. Word receives the converted drawing and places it in the
current document. Word then asks Access to look up the drawing in a data-
base. Access performs this task and returns a description of the drawing to
Word, which then formats the description and places it under the drawing in
the current document. If I had to perform this whole loop every time that I
needed a drawing, it would take 20 minutes per drawing. My Word VBA pro-
gram can perform the task in less than a minute, and the results are perfect
every time.
Defining the program means figuring out how many building blocks you need
in order to accomplish a task. You can take the simple approach and use just
one project for many programs. However, don’t make life difficult. If you need
to use multiple projects, VBA makes it easy to use them.
Adding a module
Most of your beginning programs use a single module. However, good design
begins with module definitions. You could create a huge module called 
utility
that contains every utility program you’ve ever written, but it would be a
mess. It’s like the overstressed dresser drawer that hides the tie tack or other
jewelry that you want to wear tonight: After you throw out all the contents of
the drawer into the room, you finally find the one item that you were looking
for. Instead of creating a single utility module, try creating a module for disk
utilities and another for data manipulation. Be unique! Try arranging your
modules to see what works best.
When your programming skills improve, you might want to interact with the
user in some way. You might want to ask the user questions, for example.
This task requires that you add a form to your program. Every form that you
want to create requires a separate form addition to the program. Make sure
that you create forms that ask for one kind of information — don’t confuse
the user by asking for all kinds of unrelated information on one form. (See
Chapter 7 for a description of forms and how to use them.)
Working with objects means using classes. To create a special object, add a
class module to your application. As when you’re adding forms, you should
add one class module for every new object that you want to create. Make
sure that any object that you create performs only one task. (Chapter 8
demonstrates methods for working with objects.)
69

Download 8,82 Mb.

Do'stlaringiz bilan baham:
1   ...   64   65   66   67   68   69   70   71   ...   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