Word Document Properties


Figure 6-3: Use the Debug toolbar to access debugger features. 148 Part II: Learning the Ropes



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

Figure 6-3:
Use the
Debug
toolbar to
access
debugger
features.
148
Part II: Learning the Ropes 
11_046500 ch06.qxp 12/5/06 5:35 PM Page 148


Another way to execute a break is to use the 
Debug.Assert
method. You
can use any Boolean expression with this method. If the expression is true,
program execution continues as normal. However, if the expression is false,
the program breaks so that you can examine the value. This form of break is
helpful when you know that a program should have variables with a certain
range of values.
Whenever you execute a break, the program is temporarily stopped. Click
Run Sub/User Form to start the program from the current stopping point. As
far as the program is concerned, it never stopped.
Taking individual steps
Whenever you execute a break in a running program, the debugger enables
the Step Into, Step Over, and Step Out buttons (refer to Figure 6-3). You use
these three buttons to take individual steps within the program — to execute
one line of code at a time. The reason why you want to do this is to see the
effect of each statement on the program data. When you think that a state-
ment changes a string in a certain way, you can prove it to yourself by view-
ing the effect of that particular statement.
You use the Step Over button in most cases because you want to see the
effects of statements in the current 
Sub
or 
Function
. Clicking Step Over
moves from line to line in the current code. The code still executes in any
Function
or 
Sub
called from the current 
Function
or 
Sub
, but you don’t
see it. The code executes in the background.
When you suspect that the called 
Function
or 
Sub
has an error, use the
Step Into button to go into that 
Function
or 
Sub
from the current location.
The IDE moves the cursor from the current position to the called 
Function
or 
Sub
so that you can see the code while it executes. You still view one line
at a time when using this button. The difference is that you see the called
code in addition to the 
Function
or 
Sub
of interest.
When you debug a called 
Function
or 
Sub
, you might decide that there
really isn’t an error in that section of the code. Instead of stepping through
one statement at a time until you return to the calling code, you can use the
Step Out button to return immediately. VBA still executes all the code in the
called function — it just happens in real time rather than one line at a time.
Viewing the data tips
When you execute a program break, you can view the current value of vari-
ables in several ways. The easiest way is to use the data tips feature, shown
149

Download 8,82 Mb.

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