Word Document Properties



Download 8,82 Mb.
Pdf ko'rish
bet126/207
Sana16.03.2022
Hajmi8,82 Mb.
#496217
1   ...   122   123   124   125   126   127   128   129   ...   207
Bog'liq
VBA For Dummies 5th Ed.pdf ( PDFDrive )

Listing 6-1 
(continued)
vbYesNo Or vbExclamation, _
“Drive Space Error”)
‘ Determine if the user wants to correct the 
‘ error.
If Result = vbYes Then
‘ Wait for the user to fix the problem.
MsgBox “Please click OK when you have freed” +
_
“ some disk space.”, _
vbInformation Or vbOKOnly, _
“Retry Drive Check”
‘ Go to the fallback point.
GoTo DoCheckAgain
Else
‘ The user doesn’t want to fix the error.
MsgBox “The program can’t save your data “ + _
“until the drive has enough space.”, _
vbInformation Or vbOKOnly, _
“Insufficient Drive Space”
‘ End the Sub.
Exit Sub
End If
End If
End Sub
The code begins by creating some variables. The 
FileSystemObject
object
contains information about every drive that you can access from your
machine. The 
Drive
object contains information about a specific drive. The
code uses the 
Set
keyword with objects. You 
Set
a variable equal to an
object. See Chapter 8 for details on using objects.
The code places the amount of space available into 
FreeSpace
and com-
pares it with the space needed to hold the information. You might have to
change the value in the 
If...Then
statement to match your drive. Make the
number larger than the space that your drive has available.
One interesting issue to note is that 
FreeSpace
is a 
Double
. Using earlier
versions of VBA, you would use a 
Long
, and it would provide more than suffi-
cient space. Because hard drives are getting larger, you actually need a
Double
to make the 
AvailableSpace()
method work. If you used a 
Long
today, you’d very likely see an error message because a 
Long
isn’t large
142

Download 8,82 Mb.

Do'stlaringiz bilan baham:
1   ...   122   123   124   125   126   127   128   129   ...   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