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