1*cdf0e10cSrcweir<?xml version="1.0" encoding="UTF-8"?> 2*cdf0e10cSrcweir 3*cdf0e10cSrcweir 4*cdf0e10cSrcweir<!--*********************************************************************** 5*cdf0e10cSrcweir * 6*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 7*cdf0e10cSrcweir * 8*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 9*cdf0e10cSrcweir * 10*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 11*cdf0e10cSrcweir * 12*cdf0e10cSrcweir * This file is part of OpenOffice.org. 13*cdf0e10cSrcweir * 14*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 15*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 16*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 17*cdf0e10cSrcweir * 18*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 19*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 20*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 21*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 22*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 23*cdf0e10cSrcweir * 24*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 25*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 26*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 27*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 28*cdf0e10cSrcweir * 29*cdf0e10cSrcweir ************************************************************************--> 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir<helpdocument version="1.0"> 32*cdf0e10cSrcweir<meta> 33*cdf0e10cSrcweir<topic id="textsbasicshared03103600xml" indexer="include" status="PUBLISH"> 34*cdf0e10cSrcweir<title id="tit" xml-lang="en-US">TypeName Function; VarType Function[Runtime]</title> 35*cdf0e10cSrcweir<filename>/text/sbasic/shared/03103600.xhp</filename> 36*cdf0e10cSrcweir</topic> 37*cdf0e10cSrcweir<history> 38*cdf0e10cSrcweir<created date="2003-10-31T00:00:00">Sun Microsystems, Inc.</created> 39*cdf0e10cSrcweir<lastedited date="2004-12-15T10:34:49">converted from old format - fpe</lastedited> 40*cdf0e10cSrcweir</history> 41*cdf0e10cSrcweir</meta> 42*cdf0e10cSrcweir<body> 43*cdf0e10cSrcweir<section id="typename"> 44*cdf0e10cSrcweir<bookmark xml-lang="en-US" branch="index" id="bm_id3143267"><bookmark_value>TypeName function</bookmark_value> 45*cdf0e10cSrcweir<bookmark_value>VarType function</bookmark_value> 46*cdf0e10cSrcweir</bookmark> 47*cdf0e10cSrcweir<paragraph role="heading" id="hd_id3143267" xml-lang="en-US" level="1" l10n="U" oldref="1"><link href="text/sbasic/shared/03103600.xhp" name="TypeName Function; VarType Function[Runtime]">TypeName Function; VarType Function[Runtime]</link></paragraph> 48*cdf0e10cSrcweir<paragraph role="paragraph" id="par_id3159157" xml-lang="en-US" l10n="U" oldref="2">Returns a string (TypeName) or a numeric value (VarType) that contains information for a variable.</paragraph> 49*cdf0e10cSrcweir</section> 50*cdf0e10cSrcweir<paragraph role="heading" id="hd_id3153825" xml-lang="en-US" level="2" l10n="U" oldref="3">Syntax:</paragraph> 51*cdf0e10cSrcweir<paragraph role="paragraph" id="par_id3155341" xml-lang="en-US" l10n="U" oldref="4">TypeName (Variable)VarType (Variable)</paragraph> 52*cdf0e10cSrcweir<paragraph role="heading" id="hd_id3145610" xml-lang="en-US" level="2" l10n="U" oldref="5">Return value:</paragraph> 53*cdf0e10cSrcweir<paragraph role="paragraph" id="par_id3148947" xml-lang="en-US" l10n="U" oldref="6">String; Integer</paragraph> 54*cdf0e10cSrcweir<paragraph role="heading" id="hd_id3146795" xml-lang="en-US" level="2" l10n="U" oldref="7">Parameters:</paragraph> 55*cdf0e10cSrcweir<paragraph role="paragraph" id="par_id3148664" xml-lang="en-US" l10n="U" oldref="8"> 56*cdf0e10cSrcweir<emph>Variable:</emph> The variable that you want to determine the type of. You can use the following values:</paragraph> 57*cdf0e10cSrcweir<table id="tbl_id3153362"> 58*cdf0e10cSrcweir<tablerow> 59*cdf0e10cSrcweir<tablecell colspan="" rowspan=""> 60*cdf0e10cSrcweir<paragraph role="paragraph" id="par_id3145171" xml-lang="en-US" l10n="U" oldref="9">key word</paragraph> 61*cdf0e10cSrcweir</tablecell> 62*cdf0e10cSrcweir<tablecell colspan="" rowspan=""> 63*cdf0e10cSrcweir<paragraph role="paragraph" id="par_id3156212" xml-lang="en-US" l10n="U" oldref="10">VarType</paragraph> 64*cdf0e10cSrcweir</tablecell> 65*cdf0e10cSrcweir<tablecell colspan="" rowspan=""> 66*cdf0e10cSrcweir<paragraph role="paragraph" id="par_id3154684" xml-lang="en-US" l10n="U" oldref="11">Variable type</paragraph> 67*cdf0e10cSrcweir</tablecell> 68*cdf0e10cSrcweir</tablerow> 69*cdf0e10cSrcweir<tablerow> 70*cdf0e10cSrcweir<tablecell colspan="" rowspan=""> 71*cdf0e10cSrcweir<paragraph role="paragraph" id="par_id3151041" xml-lang="en-US" l10n="U" oldref="12">Boolean</paragraph> 72*cdf0e10cSrcweir</tablecell> 73*cdf0e10cSrcweir<tablecell colspan="" rowspan=""> 74*cdf0e10cSrcweir<paragraph role="paragraph" id="par_id3153367" xml-lang="en-US" l10n="U" oldref="13">11</paragraph> 75*cdf0e10cSrcweir</tablecell> 76*cdf0e10cSrcweir<tablecell colspan="" rowspan=""> 77*cdf0e10cSrcweir<paragraph role="paragraph" id="par_id3148645" xml-lang="en-US" l10n="U" oldref="14">Boolean variable</paragraph> 78*cdf0e10cSrcweir</tablecell> 79*cdf0e10cSrcweir</tablerow> 80*cdf0e10cSrcweir<tablerow> 81*cdf0e10cSrcweir<tablecell colspan="" rowspan=""> 82*cdf0e10cSrcweir<paragraph role="paragraph" id="par_id3153138" xml-lang="en-US" l10n="U" oldref="15">Date</paragraph> 83*cdf0e10cSrcweir</tablecell> 84*cdf0e10cSrcweir<tablecell colspan="" rowspan=""> 85*cdf0e10cSrcweir<paragraph role="paragraph" id="par_id3153363" xml-lang="en-US" l10n="U" oldref="16">7</paragraph> 86*cdf0e10cSrcweir</tablecell> 87*cdf0e10cSrcweir<tablecell colspan="" rowspan=""> 88*cdf0e10cSrcweir<paragraph role="paragraph" id="par_id3155411" xml-lang="en-US" l10n="U" oldref="17">Date variable</paragraph> 89*cdf0e10cSrcweir</tablecell> 90*cdf0e10cSrcweir</tablerow> 91*cdf0e10cSrcweir<tablerow> 92*cdf0e10cSrcweir<tablecell colspan="" rowspan=""> 93*cdf0e10cSrcweir<paragraph role="paragraph" id="par_id3146975" xml-lang="en-US" l10n="U" oldref="18">Double</paragraph> 94*cdf0e10cSrcweir</tablecell> 95*cdf0e10cSrcweir<tablecell colspan="" rowspan=""> 96*cdf0e10cSrcweir<paragraph role="paragraph" id="par_id3150486" xml-lang="en-US" l10n="U" oldref="19">5</paragraph> 97*cdf0e10cSrcweir</tablecell> 98*cdf0e10cSrcweir<tablecell colspan="" rowspan=""> 99*cdf0e10cSrcweir<paragraph role="paragraph" id="par_id3148616" xml-lang="en-US" l10n="U" oldref="20">Double floating point variable</paragraph> 100*cdf0e10cSrcweir</tablecell> 101*cdf0e10cSrcweir</tablerow> 102*cdf0e10cSrcweir<tablerow> 103*cdf0e10cSrcweir<tablecell colspan="" rowspan=""> 104*cdf0e10cSrcweir<paragraph role="paragraph" id="par_id3148457" xml-lang="en-US" l10n="U" oldref="21">Integer</paragraph> 105*cdf0e10cSrcweir</tablecell> 106*cdf0e10cSrcweir<tablecell colspan="" rowspan=""> 107*cdf0e10cSrcweir<paragraph role="paragraph" id="par_id3145647" xml-lang="en-US" l10n="U" oldref="22">2</paragraph> 108*cdf0e10cSrcweir</tablecell> 109*cdf0e10cSrcweir<tablecell colspan="" rowspan=""> 110*cdf0e10cSrcweir<paragraph role="paragraph" id="par_id3154490" xml-lang="en-US" l10n="U" oldref="23">Integer variable</paragraph> 111*cdf0e10cSrcweir</tablecell> 112*cdf0e10cSrcweir</tablerow> 113*cdf0e10cSrcweir<tablerow> 114*cdf0e10cSrcweir<tablecell colspan="" rowspan=""> 115*cdf0e10cSrcweir<paragraph role="paragraph" id="par_id3149960" xml-lang="en-US" l10n="U" oldref="24">Long</paragraph> 116*cdf0e10cSrcweir</tablecell> 117*cdf0e10cSrcweir<tablecell colspan="" rowspan=""> 118*cdf0e10cSrcweir<paragraph role="paragraph" id="par_id3154513" xml-lang="en-US" l10n="U" oldref="25">3</paragraph> 119*cdf0e10cSrcweir</tablecell> 120*cdf0e10cSrcweir<tablecell colspan="" rowspan=""> 121*cdf0e10cSrcweir<paragraph role="paragraph" id="par_id3151318" xml-lang="en-US" l10n="U" oldref="26">Long integer variable</paragraph> 122*cdf0e10cSrcweir</tablecell> 123*cdf0e10cSrcweir</tablerow> 124*cdf0e10cSrcweir<tablerow> 125*cdf0e10cSrcweir<tablecell colspan="" rowspan=""> 126*cdf0e10cSrcweir<paragraph role="paragraph" id="par_id3146972" xml-lang="en-US" l10n="U" oldref="27">Object</paragraph> 127*cdf0e10cSrcweir</tablecell> 128*cdf0e10cSrcweir<tablecell colspan="" rowspan=""> 129*cdf0e10cSrcweir<paragraph role="paragraph" id="par_id3154482" xml-lang="en-US" l10n="U" oldref="28">9</paragraph> 130*cdf0e10cSrcweir</tablecell> 131*cdf0e10cSrcweir<tablecell colspan="" rowspan=""> 132*cdf0e10cSrcweir<paragraph role="paragraph" id="par_id3150323" xml-lang="en-US" l10n="U" oldref="29">Object variable</paragraph> 133*cdf0e10cSrcweir</tablecell> 134*cdf0e10cSrcweir</tablerow> 135*cdf0e10cSrcweir<tablerow> 136*cdf0e10cSrcweir<tablecell colspan="" rowspan=""> 137*cdf0e10cSrcweir<paragraph role="paragraph" id="par_id3148405" xml-lang="en-US" l10n="U" oldref="30">Single</paragraph> 138*cdf0e10cSrcweir</tablecell> 139*cdf0e10cSrcweir<tablecell colspan="" rowspan=""> 140*cdf0e10cSrcweir<paragraph role="paragraph" id="par_id3149020" xml-lang="en-US" l10n="U" oldref="31">4</paragraph> 141*cdf0e10cSrcweir</tablecell> 142*cdf0e10cSrcweir<tablecell colspan="" rowspan=""> 143*cdf0e10cSrcweir<paragraph role="paragraph" id="par_id3147341" xml-lang="en-US" l10n="U" oldref="32">Single floating-point variable</paragraph> 144*cdf0e10cSrcweir</tablecell> 145*cdf0e10cSrcweir</tablerow> 146*cdf0e10cSrcweir<tablerow> 147*cdf0e10cSrcweir<tablecell colspan="" rowspan=""> 148*cdf0e10cSrcweir<paragraph role="paragraph" id="par_id3155901" xml-lang="en-US" l10n="U" oldref="33">String</paragraph> 149*cdf0e10cSrcweir</tablecell> 150*cdf0e10cSrcweir<tablecell colspan="" rowspan=""> 151*cdf0e10cSrcweir<paragraph role="paragraph" id="par_id3155960" xml-lang="en-US" l10n="U" oldref="34">8</paragraph> 152*cdf0e10cSrcweir</tablecell> 153*cdf0e10cSrcweir<tablecell colspan="" rowspan=""> 154*cdf0e10cSrcweir<paragraph role="paragraph" id="par_id3146313" xml-lang="en-US" l10n="U" oldref="35">String variable</paragraph> 155*cdf0e10cSrcweir</tablecell> 156*cdf0e10cSrcweir</tablerow> 157*cdf0e10cSrcweir<tablerow> 158*cdf0e10cSrcweir<tablecell colspan="" rowspan=""> 159*cdf0e10cSrcweir<paragraph role="paragraph" id="par_id3145149" xml-lang="en-US" l10n="U" oldref="36">Variant</paragraph> 160*cdf0e10cSrcweir</tablecell> 161*cdf0e10cSrcweir<tablecell colspan="" rowspan=""> 162*cdf0e10cSrcweir<paragraph role="paragraph" id="par_id3154021" xml-lang="en-US" l10n="U" oldref="37">12</paragraph> 163*cdf0e10cSrcweir</tablecell> 164*cdf0e10cSrcweir<tablecell colspan="" rowspan=""> 165*cdf0e10cSrcweir<paragraph role="paragraph" id="par_id3145789" xml-lang="en-US" l10n="U" oldref="38">Variant variable (can contain all types specified by the definition)</paragraph> 166*cdf0e10cSrcweir</tablecell> 167*cdf0e10cSrcweir</tablerow> 168*cdf0e10cSrcweir<tablerow> 169*cdf0e10cSrcweir<tablecell colspan="" rowspan=""> 170*cdf0e10cSrcweir<paragraph role="paragraph" id="par_id3148630" xml-lang="en-US" l10n="U" oldref="39">Empty</paragraph> 171*cdf0e10cSrcweir</tablecell> 172*cdf0e10cSrcweir<tablecell colspan="" rowspan=""> 173*cdf0e10cSrcweir<paragraph role="paragraph" id="par_id3152584" xml-lang="en-US" l10n="U" oldref="40">0</paragraph> 174*cdf0e10cSrcweir</tablecell> 175*cdf0e10cSrcweir<tablecell colspan="" rowspan=""> 176*cdf0e10cSrcweir<paragraph role="paragraph" id="par_id3151278" xml-lang="en-US" l10n="U" oldref="41">Variable is not initialized</paragraph> 177*cdf0e10cSrcweir</tablecell> 178*cdf0e10cSrcweir</tablerow> 179*cdf0e10cSrcweir<tablerow> 180*cdf0e10cSrcweir<tablecell colspan="" rowspan=""> 181*cdf0e10cSrcweir<paragraph role="paragraph" id="par_id3154576" xml-lang="en-US" l10n="U" oldref="42">Null</paragraph> 182*cdf0e10cSrcweir</tablecell> 183*cdf0e10cSrcweir<tablecell colspan="" rowspan=""> 184*cdf0e10cSrcweir<paragraph role="paragraph" id="par_id3166424" xml-lang="en-US" l10n="U" oldref="43">1</paragraph> 185*cdf0e10cSrcweir</tablecell> 186*cdf0e10cSrcweir<tablecell colspan="" rowspan=""> 187*cdf0e10cSrcweir<paragraph role="paragraph" id="par_id3145131" xml-lang="en-US" l10n="U" oldref="44">No valid data</paragraph> 188*cdf0e10cSrcweir</tablecell> 189*cdf0e10cSrcweir</tablerow> 190*cdf0e10cSrcweir</table> 191*cdf0e10cSrcweir<embed href="text/sbasic/shared/00000003.xhp#errorcode"/> 192*cdf0e10cSrcweir<embed href="text/sbasic/shared/00000003.xhp#err5"/> 193*cdf0e10cSrcweir<paragraph role="heading" id="hd_id3149338" xml-lang="en-US" level="2" l10n="U" oldref="45">Example:</paragraph> 194*cdf0e10cSrcweir<paragraph role="paragraph" id="par_id3150363" xml-lang="en-US" l10n="U" oldref="46">Sub ExampleType</paragraph> 195*cdf0e10cSrcweir<paragraph role="paragraph" id="par_id3159088" xml-lang="en-US" l10n="U" oldref="47">Dim iVar As Integer</paragraph> 196*cdf0e10cSrcweir<paragraph role="paragraph" id="par_id3150089" xml-lang="en-US" l10n="U" oldref="48">Dim sVar As String</paragraph> 197*cdf0e10cSrcweir<paragraph role="paragraph" id="par_id3156139" xml-lang="en-US" l10n="U" oldref="49">Dim siVar As Single</paragraph> 198*cdf0e10cSrcweir<paragraph role="paragraph" id="par_id3151217" xml-lang="en-US" l10n="U" oldref="50">Dim dVar As Double</paragraph> 199*cdf0e10cSrcweir<paragraph role="paragraph" id="par_id3154658" xml-lang="en-US" l10n="U" oldref="51">Dim bVar As Boolean</paragraph> 200*cdf0e10cSrcweir<paragraph role="paragraph" id="par_id3152992" xml-lang="en-US" l10n="U" oldref="52">Dim lVar As Long</paragraph> 201*cdf0e10cSrcweir<paragraph role="paragraph" id="par_id3155509" xml-lang="en-US" l10n="U" oldref="53">Msgbox TypeName(iVar) & " " & VarType(iVar) & Chr(13) &_</paragraph> 202*cdf0e10cSrcweir<paragraph role="paragraph" id="par_id3150370" xml-lang="en-US" l10n="CHG" oldref="54">TypeName(sVar) & " " & VarType(sVar) & Chr(13) &_</paragraph> 203*cdf0e10cSrcweir<paragraph role="paragraph" id="par_id3155532" xml-lang="en-US" l10n="U" oldref="55">TypeName(siVar) & " " & VarType(siVar) & Chr(13) &_</paragraph> 204*cdf0e10cSrcweir<paragraph role="paragraph" id="par_id3152988" xml-lang="en-US" l10n="U" oldref="56">TypeName(dVar) & " " & VarType(dVar) & Chr(13) &_</paragraph> 205*cdf0e10cSrcweir<paragraph role="paragraph" id="par_id3156166" xml-lang="en-US" l10n="U" oldref="57">TypeName(bVar) & " " & VarType(bVar) & Chr(13) &_</paragraph> 206*cdf0e10cSrcweir<paragraph role="paragraph" id="par_id3148817" xml-lang="en-US" l10n="U" oldref="58">TypeName(lVar) & " " & VarType(lVar),0,"Some types in $[officename] Basic"</paragraph> 207*cdf0e10cSrcweir<paragraph role="paragraph" id="par_id3154259" xml-lang="en-US" l10n="U" oldref="59">end Sub</paragraph> 208*cdf0e10cSrcweir</body> 209*cdf0e10cSrcweir</helpdocument> 210