[ Pobierz całość w formacie PDF ]
.Example Sub MainDebug.Print Int(9.9) 9Debug.Print Int(0) 0Debug.Print Int(-9.9) -10End Sub164 / Chapter 8Integer Data TypeDescription A 16-bit integer value.Is OperatorSyntax expr Is exprDescription Returns True if both exprs refer to the same object.See also ObjectsExample Sub MainDim X As ObjectDim Y As ObjectDebug.Print X Is Y TrueEnd SubIsArray FunctionSyntax IsArray (var)Description Returns True if var is an array of values.Parameter Descriptionvar An array variable or a variant var can contain multiple values.See also TypeName, VarTypeExample Sub MainDim X As Variant, Y(2) As IntegerDebug.Print IsArray(X) FalseX = Array(1,4,9)Debug.Print IsArray(X) TrueX = YDebug.Print IsArray(X) TrueEnd SubLanguage Reference / 165IsDate FunctionSyntax IsDate (expr)Description Returns True if expr is a valid date.Parameter Descriptionexpr A variant expression to test for a valid date.See also TypeName, VarTypeExample Sub MainDim X As VariantX = 1Debug.Print IsDate(X) FalseX = NowDebug.Print IsDate(X) TrueEnd SubIsEmpty FunctionSyntax IsEmpty (variantvar)Description Returns True if variantvar is Empty.Parameter Descriptionvariantvar A variant var is Empty if it has never been assigned a value.See also TypeName, VarTypeExample Sub MainDim X As VariantDebug.Print IsEmpty(X) TrueX = 0Debug.Print IsEmpty(X) FalseX = EmptyDebug.Print IsEmpty(X) TrueEnd Sub166 / Chapter 8IsError FunctionSyntax IsError (expr)Description Returns True if expr is an error code.Parameter Descriptionexpr A variant expression to test for an error-code value.See also TypeName, VarTypeExample Sub MainDim X As VariantDebug.Print IsError(X) FalseX = CVErr(1)Debug.Print IsError(X) TrueEnd SubIsMissing FunctionSyntax IsMissing (variantvar)Description Returns the True if Optional parameter variantvar did not get a value.AnOptional or ParamArray parameter may be omitted in the Sub, Function,or Property call.Parameter Descriptionvariantvar Returns True if this parameter s argument expression was notspecified in the Sub, Function, or Property call.Example Sub MainOpt IsMissing(A)=TrueOpt Hi IsMissing(A)=FalseMany No argsMany 1,"Hello" A(0)=1 A(1)=HelloEnd SubSub Opt(Optional A)Debug.Print IsMissing(A)= ;IsMissing(A)End SubLanguage Reference / 167Sub Many(ParamArray A())If LBound(A) UBound(A) ThenDebug.Print No argsElseFor I = LBound(A) To UBound(A)Debug.Print A( & I & )= & A(I) & ;Next IDebug.PrintEnd IfEnd SubIsNull FunctionSyntax IsNull (expr)Description Returns True if expr is null.Parameter Descriptionexpr A variant expression to test for Null.See also TypeName, VarTypeExample Sub MainDim X As VariantDebug.Print IsEmpty(X) TrueDebug.Print IsNull (X) FalseX = 1Debug.Print Is Null FalseX = 1"Debug.Print IsNull (X) FalseX = NullDebug.Print IsNull (X) TrueX = X*2Debug.Print IsNull(X) TrueEnd SubIsNumeric FunctionSyntax IsNumeric (expr)Description Returns True if expr is a numeric value.168 / Chapter 8Parameter Descriptionexpr A variant expression is a numeric value if it is numeric or if it is astring value that represents a number.See also TypeName, VarTypeExample Sub MainDim X As VariantX = 1Debug.Print IsNumeric(X) TrueX = 1"Debug.Print IsNumeric(X) TrueX = A"Debug.Print IsNumeric(X) FalseEnd SubIsObject FunctionSyntax IsObject (var)Description Returns True if var contains an object reference.Parameter Descriptionvar A var contains an object reference if it is an objexpr reference.See also TypeName, VarTypeExample Sub MainDim X As VariantX = 1Debug.Print IsObject(X) FalseX = 1"Debug.Print IsObject(X) FalseSet X = NothingDebug.Print IsObject(X) TrueEnd SubLanguage Reference / 169Kill InstructionSyntax Kill Name$Description Deletes the file specified by Name$.Parameter DescriptionName$ This string value is the path and name of the file.A path relativeto the current directory can be used.Example Sub MainKill XXXEnd SubLBound FunctionSyntax LBound (var[, dimension])Description Returns the lowest index.Parameter Descriptionvar Returns the lowest index for this array variable.dimension Returns the lowest index for this dimension of var.If this isomitted, it returns the lowest index for the first dimension.See also UBound( )Example Sub MainDim A(-1 To 3,2 To 6)Debug.Print LBound(A) -1Debug.Print LBound(A,1) -1Debug.Print LBound(A,2) 2End SubLCase$ FunctionSyntax LCase [$] (S$)Description Returns a string from S$ in which all the uppercase letters have beenlowercased.170 / Chapter 8Parameter DescriptionS$ Returns the string value of this parameter after all chars havebeen converted to lowercase.See also UCase$( )Example Sub MainDebug.Print LCase$( Hello ) "hello"End SubLeft$ FunctionSyntax Left [$] (S$, Len)Description Returns a string from S$ with only the Len chars.Parameter DescriptionS$ Returns the left portion of this string value.Len Return this many chars.If S$ holds fewer than Len chars, itreturns S$
[ Pobierz całość w formacie PDF ]