Word Document Properties


Chapter 8: Object-Oriented Programming



Download 8,82 Mb.
Pdf ko'rish
bet161/207
Sana16.03.2022
Hajmi8,82 Mb.
#496217
1   ...   157   158   159   160   161   162   163   164   ...   207
Bog'liq
VBA For Dummies 5th Ed.pdf ( PDFDrive )

Chapter 8: Object-Oriented Programming
14_046500 ch08.qxp 12/5/06 5:36 PM Page 191


Listing 8-2 
(continued)
‘ the user about the problem.
Err.Raise vbObjectError + 1, _
“SpecialMsg.Show”, _
“You must provide a HelpFilename “ +
_
“property value to use the Help “ +
_
“button in a message box.”
Else
‘ The user has provided all required help
‘ information, so set the help button option.
Options = Options Or vbMsgBoxHelpButton
End If
End If
‘ Determine if the message box will display help.
If ((TheHelpFile = “”) And (Not UseHelpButton)) Then
‘ Display a message box without help.
Result = MsgBox(ThePrompt, Options, TheTitle)
Else
‘ Display a message box that includes help.
Result = MsgBox(ThePrompt, Options, TheTitle, _
TheHelpFile, TheHelpContext)
End If
‘ Raise the Click event so the caller can react to it.
RaiseEvent Click(Result)
‘ Return a result.
Show = Result
End Function
The 
MsgBox
function provides access to a number of styles. It’s easy to
forget how many styles until you start looking at code like this. The code 
creates an 
Options
variable that contains all the style options that you’ve
set up through object properties. It selects an icon, a button set, a default
button, and a modality type (application or system). These options always
appear in the list, and the 
Class_Initialize
method sets them to default
values. (See the upcoming “Defining initialization” section for details.) The
Options
variable can also contain a number of optional settings. The code
checks the Boolean values, such as 
UseForeground
, to determine whether
you want to include these optional styles. It then adds the actual style to the
Options
variable.
Notice that the 
UseHelpButton If...Then
statement includes error 
handling. See the upcoming “Adding Error Handling to Classes” section for a
description of class error handling. In this case, the class determines whether
you’ve assigned a help file to the message object. If not, clicking the Help
button causes an error. The 
MsgBox
function doesn’t protect you from this
error, but the 
SpecialMsg
class does.
192

Download 8,82 Mb.

Do'stlaringiz bilan baham:
1   ...   157   158   159   160   161   162   163   164   ...   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