Word Document Properties


Chapter 4: Storing and Modifying Information



Download 8,82 Mb.
Pdf ko'rish
bet99/207
Sana16.03.2022
Hajmi8,82 Mb.
#496217
1   ...   95   96   97   98   99   100   101   102   ...   207
Bog'liq
VBA For Dummies 5th Ed.pdf ( PDFDrive )

Chapter 4: Storing and Modifying Information
09_046500 ch04.qxp 12/5/06 5:54 PM Page 103


You can also use the 
Variant
type as a means for data conversion. Place a
date within a 
Variant
, such as 1/1/80, and you can convert it to a 
String
or an 
Integer
. The 
Integer
value for this date normally appears as 
29221
when using the default Windows settings. You can use the 
Integer
value as
input to the 
Date
function to convert the number back into a 
Date
and then
place the result back into the 
Variant
.
About now, you may think that the 
Variant
data type is the best data type
to use for all situations, and it’s definitely the right choice in many situations.
However, all of the added functionality that the 
Variant
data type supports
comes with a price. 
Variant
variables consume more memory than any
other data type because the 
Variant
data type must support all data types
equally well. In addition, the 
Variant
data type slows application perfor-
mance because VBA must first discover how to interact with the 
Variant
variable. Because a 
Variant
variable is essentially undefined, you’ll also find
it harder to debug applications that use them, and the VBA automation won’t
work as well with 
Variant
variables. Many security problems that you could
locate using other data types are completely hidden when using 
Variant
variables because the data type plays a part in making your applications
more secure (for example, you can’t place a string in a number). In short,
the
Variant
data type does solve a host of problems, but adds a significant
number of problems of its own.
Presenting data in a pleasing format
Most programs can use the default formatting that VBA provides for output.
However, you might need some way to present the data in another way, such
as a short or long date (04/24/06 or 24 April 2006). It’s important to know how
to format data so that you can create astounding reports and concise analysis.
Using the Format function
The 
Format
function is the most common way to change the appearance of
data. This function accepts any valid expression as input. You can also supply
an expression that defines how to format the data. The Named Date/Time
Formats help topic describes predefined formats for date and time, and the
Named Numeric Formats help topic describes numeric formats. Listing 4-15
demonstrates some of the common, named formats for time and date.

Download 8,82 Mb.

Do'stlaringiz bilan baham:
1   ...   95   96   97   98   99   100   101   102   ...   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