Word Document Properties


Chapter 7: Interacting with the User



Download 8,82 Mb.
Pdf ko'rish
bet148/207
Sana16.03.2022
Hajmi8,82 Mb.
#496217
1   ...   144   145   146   147   148   149   150   151   ...   207
Bog'liq
VBA For Dummies 5th Ed.pdf ( PDFDrive )

Chapter 7: Interacting with the User
12_046500 ch07.qxp 12/5/06 5:35 PM Page 171


The 
btnStatus_Click
sub-procedure retrieves the current selections that
use the control’s 
Value
property. It displays a message box containing essen-
tially the same information as the 
OptionButton
example in the preceding
“Making choices with option buttons and frames” section.
Although this code performs essentially the same task as the 
OptionButton
code, it requires far less code. In fact, this code actually provides more input
choices than the 
OptionButton
example.
Adding controls to the Toolbox
You might find that you need other controls in order to create your program.
Windows provides a wealth of controls that you can use. The Toolbox that
VBA provides has only a few essential controls in it — you can always add
more by using the following procedure:
1. Right-click anywhere on the Controls page of the Toolbox, and then
choose Additional Controls from the context menu that appears.
You see the Additional Controls dialog box, shown in Figure 7-6.
2. Select the control that you want to add to your Toolbox by placing a
check mark next to its entry.
3. Click OK.
VBA adds the selected control to your Toolbox.
The Toolbox can get crowded after you add a few controls to it. You can
add pages to the Toolbox by right-clicking outside the existing pages and
then choosing New Page from the context menu that appears. Getting rid of
a page is as easy as selecting that page, right-clicking outside the page area,
Figure 7-6:
Add
controls 
to your
Toolbox by
using the
options 
in this 
dialog box.
172
Part II: Learning the Ropes 
12_046500 ch07.qxp 12/5/06 5:35 PM Page 172


and then choosing Delete Page from the context menu that appears. It’s also
easy to move and rename pages by using context menu entries.
Using the Forms You Create
Forms are useful only if they’re usable. This means modifying the form and
control properties to provide a pleasant appearance. You should change 
certain properties every time that you create a form to ensure that everyone
can use it easily. Arranging the content of the form onscreen is important,
as is making sure that the form operates correctly. Finally, you need to know
how to handle events that the form generates to ensure that you see the
expected results.
Modifying the form and control properties
In previous sections of this chapter, you discovered properties that you can
change on your form or control to get specific results. Whenever you select
the form or a control that it contains, the Properties window changes to
match the selection.
You might look at the enormous list of properties provided with the form and
controls and wonder how you can memorize them all. The fact is that you
don’t have to memorize any of them. To see what task a property performs,
highlight that property and then press F1. VBA provides property-specific help.
Some properties provide exceptional value from a user perspective. Always
define the 
Accelerator
property for your controls. This property lets some-
one use the keyboard, rather than the mouse, to access the control. It’s an
essential property if you want to make your program accessible to those with
special needs.
When you use a 
Label
control to provide accelerator key access for a con-
trol that doesn’t include a 
Caption
property, make sure that the 
TabIndex
property value for the 
Label
is one less than the control that it references.
For example, if a 
TextBox
has a 
TabIndex
value of 
5
, the associated 
Label
should have a 
TabIndex
value of 
4
. Otherwise, the accelerator key doesn’t
work as anticipated.
Another important property is 
ControlTipText
. Type a description of the
control’s purpose in this property. When you hover the mouse over the con-
trol, VBA displays the text that you typed as balloon help. This kind of help is
a halfway point between the prompt that you type and the context-sensitive
help that your program should provide. It gives additional information with-
out opening the help file.
173

Download 8,82 Mb.

Do'stlaringiz bilan baham:
1   ...   144   145   146   147   148   149   150   151   ...   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