Word Document Properties



Download 8,82 Mb.
Pdf ko'rish
bet131/207
Sana16.03.2022
Hajmi8,82 Mb.
#496217
1   ...   127   128   129   130   131   132   133   134   ...   207
Bog'liq
VBA For Dummies 5th Ed.pdf ( PDFDrive )

menu that appears.
You see the Export File dialog box.
3. Choose a location for the module, form, or class module and then
click Save.
VBA exports the file.
Importing a module in a program
The library that you build while you write VBA programs is an important
resource because it reduces the need to write new code. Every time that you
need to reuse existing code, you can import the module by using the follow-
ing procedure:
1. Right-click anywhere in the Project Explorer window and then choose
Import File from the context menu that appears.
You see the Import File dialog box.
2. Locate the BAS, FRM, or CLS file that you want to import.
3. Highlight the file and then click Open.
The module appears in the Project Explorer window in the appropriate
folder.
147
Chapter 6: Trapping Errors and Squashing Bugs
11_046500 ch06.qxp 12/5/06 5:35 PM Page 147


Time for a Bug Hunt
You aren’t alone when you have a bug to find in your program, because the
VBA IDE provides a special tool called a debugger. The 
debugger
is a built-in
feature that you access by using a special Debug toolbar. Figure 6-3 shows the
Debug toolbar. Add it to your IDE by right-clicking the toolbar area and then
choosing Debug from the list of available toolbars.
Executing a break
Whenever you open your program in the VBA IDE and execute it from there,
the program is in debug mode. Using debug mode lets you stop the program
and see what it’s doing at any particular moment. Stopping the program can
help you not only find bugs but also discover more about VBA and how to
use it. You can use this feature to view other people’s code to see how they
perform programming tasks.
Before you can stop execution of your program, you need to tell VBA where
to stop. A stop within a VBA program is a 
breakpoint.
To add a breakpoint to
your code, highlight the stopping point and then click Toggle Breakpoint on
the Debug toolbar. When you click Run Sub/User Form, VBA automatically
stops at the point that you selected.
When your program has a natural stop, such as in a form or at an 
InputBox
statement, you can also click Break on the Debug toolbar to stop the pro-
gram. (See the earlier “Writing your own error-handling code” section for an
example of the 
InputBox
statement.) The Break button differs from the
Reset button because it only pauses execution. Clicking Reset always stops
the program, and you have to restart it from the beginning.
Run Sub/User Form
Break
Toggle Breakpoint
Step Into
Step Out
Immediate window
Quick Watch
Reset
Step Over
Locals window
Watch window
Call Stack

Download 8,82 Mb.

Do'stlaringiz bilan baham:
1   ...   127   128   129   130   131   132   133   134   ...   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