Word Document Properties


Part II: Learning the Ropes



Download 8,82 Mb.
Pdf ko'rish
bet63/207
Sana16.03.2022
Hajmi8,82 Mb.
#496217
1   ...   59   60   61   62   63   64   65   66   ...   207
Bog'liq
VBA For Dummies 5th Ed.pdf ( PDFDrive )

Part II: Learning the Ropes 
08_046500 ch03.qxp 12/5/06 5:34 PM Page 62


Adding conditional compilation
Conditional compilation 
is an essential feature for creating multiple versions
of your program. Normally, VBA goes through your list of statements and per-
forms them one at a time. However, using conditional compilations allows
VBA to perform a task in one way while you write and test the program, and
in another way when you finish it.
The most common use for this feature is to help debug a program. In Chapter 6,
I show you how to use conditional compilation to debug your application.
However, for now, just to have a little fun, you can create a very simple 
program that shows how this feature works. First, make sure that you
type
myDebug = 0
in the Conditional Compilation Arguments field and
then click OK. Then type the following program in a module (see the 
“Step 2: Implement the design” section of Chapter 2 for instructions on 
creating a module):
Public Sub CheckConditional()
#If myDebug = 0 Then
MsgBox “In Standard Mode”
#Else
MsgBox “In Debug Mode”
#End If
End Sub
This program says that if 
myDebug
is set to 
0
, the program should display a
message box that reads 
In Standard Mode
. If 
myDebug
is set to any other
value, the program should display a message box that reads 
In Debug
Mode
. Run the program, and you should see a message box that reads 
In
Standard Mode
.
63
Chapter 3: Writing Structured VBA Programs
Avoiding code-locking security issues
One consideration for code locking is that it can
provide a false sense of security. Although code
locking keeps novice users from modifying your
code, it doesn’t keep out dedicated crackers. The
Internet contains offerings from many vendors
who offer to unlock your Office documents for
you when you lose the password. Unfortunately,
the same application that can help you retrieve
your documents when you forget the password
can also give crackers access to it. The best
policy to follow is to use code locking when you
need to protect novice users from themselves,
rather than as a means for protecting your
investment in the code itself.
08_046500 ch03.qxp 12/5/06 5:34 PM Page 63


Open the Project Properties dialog box again. Change the Conditional
Compilation Arguments field so that it reads 

Download 8,82 Mb.

Do'stlaringiz bilan baham:
1   ...   59   60   61   62   63   64   65   66   ...   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