Word Document Properties


Part I: An Overview of VBA



Download 8,82 Mb.
Pdf ko'rish
bet52/207
Sana16.03.2022
Hajmi8,82 Mb.
#496217
1   ...   48   49   50   51   52   53   54   55   ...   207
Bog'liq
VBA For Dummies 5th Ed.pdf ( PDFDrive )

Part I: An Overview of VBA 
06_046500 ch02.qxp 12/5/06 5:33 PM Page 48


Part II
Learning 
the Ropes
07_046500 pt02.qxp 12/5/06 5:34 PM Page 49


In this part . . .
E
very adventure begins with a discovery phase. This
part of the book is all about discovery. You consider
all the elements that define VBA as a language. Good
structure is the basis of most projects in life. When you
build a house, you create the basic structure first and
then add on to it. Chapter 3 is all about VBA program
structure. You discover how to create a framework for the
programs that you build later.
In Chapter 4, I help you understand how to manage data
by using VBA. Data management is the single most impor-
tant skill that a programmer can learn. This chapter also
provides useful information about questions that VBA pro-
grammers ask most often, such as when to use + or & to
concatenate strings (add them together).
In Chapter 5, I tell you how to control program flow by
using several techniques. Controlling program flow lets
you do things like make decisions. In Chapter 6, I show
you techniques for debugging your program (removing
errors). Debugging is an essential part of creating great
applications. In Chapter 7, I help you discover the joys of
creating a user interface.
07_046500 pt02.qxp 12/5/06 5:34 PM Page 50


Chapter 3
Writing Structured VBA Programs
In This Chapter
Discovering the structure used by most programs
Using structure to your advantage
Creating programs by using the Macro Recorder
Creating a program by using a 
Sub
Creating a program by using a 
Function
Hiding some program elements by using scope
Adding white space to programs
Adding comments to your code
I
n Chapters 1 and 2, I concentrate on describing the basics of VBA pro-
gramming without discussing an important element that VBA programs
need — structure. Adding structure makes code easier to read and use.
It’s also a mandatory part of the development process.
There are a number of ways to look at structure in a program. Just as you use
an outline to structure a presentation, you need to add structure to your pro-
gram to make it work properly. Using structure in a program is like using a
checklist with a large customer order — it helps you ensure that all the pro-
gram elements are in place. The structure that you add to a program is like
presenting numeric information with a graph — it makes the content of the
program easier to see and understand.
In this chapter, I present various forms of structure. The obvious structuring
element is physical. By using physical structure, you can divide your pro-
gram into small pieces that are easy to write and understand. Many people
divide programs into task-oriented pieces. It helps to use the Macro Recorder
to see how you can create small tasks out of larger procedures, so this chap-
ter discusses how to use the Macro Recorder to discover more about your
specific program needs.
Another form of structure includes the concept of privacy. Consider who can
see your program and how they can use it. 
Scope,
which is the act of deter-
mining the range of program access, is important because you want to make
some parts completely private and other parts completely public.
08_046500 ch03.qxp 12/5/06 5:34 PM Page 51


Finally, there are visual elements of structure. How you use white space when
you write your program can make the difference between reading it and
scratching your head. In Chapter 2, I discuss the use of comments in the
form of pseudo-code, but you might find that you need additional comments
to help someone truly understand your program (and to jog your memory
when you need to make alterations).
Download 8,82 Mb.

Do'stlaringiz bilan baham:
1   ...   48   49   50   51   52   53   54   55   ...   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