1<?xml version="1.0" encoding="UTF-8"?>
2
3
4<!--***********************************************************
5 *
6 * Licensed to the Apache Software Foundation (ASF) under one
7 * or more contributor license agreements.  See the NOTICE file
8 * distributed with this work for additional information
9 * regarding copyright ownership.  The ASF licenses this file
10 * to you under the Apache License, Version 2.0 (the
11 * "License"); you may not use this file except in compliance
12 * with the License.  You may obtain a copy of the License at
13 *
14 *   http://www.apache.org/licenses/LICENSE-2.0
15 *
16 * Unless required by applicable law or agreed to in writing,
17 * software distributed under the License is distributed on an
18 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
19 * KIND, either express or implied.  See the License for the
20 * specific language governing permissions and limitations
21 * under the License.
22 *
23 ***********************************************************-->
24
25
26
27<helpdocument version="1.0">
28<meta>
29<topic id="textsbasicshared03103600xml" indexer="include" status="PUBLISH">
30<title id="tit" xml-lang="en-US">TypeName Function; VarType Function[Runtime]</title>
31<filename>/text/sbasic/shared/03103600.xhp</filename>
32</topic>
33<history>
34<created date="2003-10-31T00:00:00">Sun Microsystems, Inc.</created>
35<lastedited date="2004-12-15T10:34:49">converted from old format - fpe</lastedited>
36</history>
37</meta>
38<body>
39<section id="typename">
40<bookmark xml-lang="en-US" branch="index" id="bm_id3143267"><bookmark_value>TypeName function</bookmark_value>
41<bookmark_value>VarType function</bookmark_value>
42</bookmark>
43<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>
44<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>
45</section>
46<paragraph role="heading" id="hd_id3153825" xml-lang="en-US" level="2" l10n="U" oldref="3">Syntax:</paragraph>
47<paragraph role="paragraph" id="par_id3155341" xml-lang="en-US" l10n="U" oldref="4">TypeName (Variable)VarType (Variable)</paragraph>
48<paragraph role="heading" id="hd_id3145610" xml-lang="en-US" level="2" l10n="U" oldref="5">Return value:</paragraph>
49<paragraph role="paragraph" id="par_id3148947" xml-lang="en-US" l10n="U" oldref="6">String; Integer</paragraph>
50<paragraph role="heading" id="hd_id3146795" xml-lang="en-US" level="2" l10n="U" oldref="7">Parameters:</paragraph>
51<paragraph role="paragraph" id="par_id3148664" xml-lang="en-US" l10n="U" oldref="8">
52<emph>Variable:</emph> The variable that you want to determine the type of. You can use the following values:</paragraph>
53<table id="tbl_id3153362">
54<tablerow>
55<tablecell colspan="" rowspan="">
56<paragraph role="paragraph" id="par_id3145171" xml-lang="en-US" l10n="U" oldref="9">key word</paragraph>
57</tablecell>
58<tablecell colspan="" rowspan="">
59<paragraph role="paragraph" id="par_id3156212" xml-lang="en-US" l10n="U" oldref="10">VarType</paragraph>
60</tablecell>
61<tablecell colspan="" rowspan="">
62<paragraph role="paragraph" id="par_id3154684" xml-lang="en-US" l10n="U" oldref="11">Variable type</paragraph>
63</tablecell>
64</tablerow>
65<tablerow>
66<tablecell colspan="" rowspan="">
67<paragraph role="paragraph" id="par_id3151041" xml-lang="en-US" l10n="U" oldref="12">Boolean</paragraph>
68</tablecell>
69<tablecell colspan="" rowspan="">
70<paragraph role="paragraph" id="par_id3153367" xml-lang="en-US" l10n="U" oldref="13">11</paragraph>
71</tablecell>
72<tablecell colspan="" rowspan="">
73<paragraph role="paragraph" id="par_id3148645" xml-lang="en-US" l10n="U" oldref="14">Boolean variable</paragraph>
74</tablecell>
75</tablerow>
76<tablerow>
77<tablecell colspan="" rowspan="">
78<paragraph role="paragraph" id="par_id3153138" xml-lang="en-US" l10n="U" oldref="15">Date</paragraph>
79</tablecell>
80<tablecell colspan="" rowspan="">
81<paragraph role="paragraph" id="par_id3153363" xml-lang="en-US" l10n="U" oldref="16">7</paragraph>
82</tablecell>
83<tablecell colspan="" rowspan="">
84<paragraph role="paragraph" id="par_id3155411" xml-lang="en-US" l10n="U" oldref="17">Date variable</paragraph>
85</tablecell>
86</tablerow>
87<tablerow>
88<tablecell colspan="" rowspan="">
89<paragraph role="paragraph" id="par_id3146975" xml-lang="en-US" l10n="U" oldref="18">Double</paragraph>
90</tablecell>
91<tablecell colspan="" rowspan="">
92<paragraph role="paragraph" id="par_id3150486" xml-lang="en-US" l10n="U" oldref="19">5</paragraph>
93</tablecell>
94<tablecell colspan="" rowspan="">
95<paragraph role="paragraph" id="par_id3148616" xml-lang="en-US" l10n="U" oldref="20">Double floating point variable</paragraph>
96</tablecell>
97</tablerow>
98<tablerow>
99<tablecell colspan="" rowspan="">
100<paragraph role="paragraph" id="par_id3148457" xml-lang="en-US" l10n="U" oldref="21">Integer</paragraph>
101</tablecell>
102<tablecell colspan="" rowspan="">
103<paragraph role="paragraph" id="par_id3145647" xml-lang="en-US" l10n="U" oldref="22">2</paragraph>
104</tablecell>
105<tablecell colspan="" rowspan="">
106<paragraph role="paragraph" id="par_id3154490" xml-lang="en-US" l10n="U" oldref="23">Integer variable</paragraph>
107</tablecell>
108</tablerow>
109<tablerow>
110<tablecell colspan="" rowspan="">
111<paragraph role="paragraph" id="par_id3149960" xml-lang="en-US" l10n="U" oldref="24">Long</paragraph>
112</tablecell>
113<tablecell colspan="" rowspan="">
114<paragraph role="paragraph" id="par_id3154513" xml-lang="en-US" l10n="U" oldref="25">3</paragraph>
115</tablecell>
116<tablecell colspan="" rowspan="">
117<paragraph role="paragraph" id="par_id3151318" xml-lang="en-US" l10n="U" oldref="26">Long integer variable</paragraph>
118</tablecell>
119</tablerow>
120<tablerow>
121<tablecell colspan="" rowspan="">
122<paragraph role="paragraph" id="par_id3146972" xml-lang="en-US" l10n="U" oldref="27">Object</paragraph>
123</tablecell>
124<tablecell colspan="" rowspan="">
125<paragraph role="paragraph" id="par_id3154482" xml-lang="en-US" l10n="U" oldref="28">9</paragraph>
126</tablecell>
127<tablecell colspan="" rowspan="">
128<paragraph role="paragraph" id="par_id3150323" xml-lang="en-US" l10n="U" oldref="29">Object variable</paragraph>
129</tablecell>
130</tablerow>
131<tablerow>
132<tablecell colspan="" rowspan="">
133<paragraph role="paragraph" id="par_id3148405" xml-lang="en-US" l10n="U" oldref="30">Single</paragraph>
134</tablecell>
135<tablecell colspan="" rowspan="">
136<paragraph role="paragraph" id="par_id3149020" xml-lang="en-US" l10n="U" oldref="31">4</paragraph>
137</tablecell>
138<tablecell colspan="" rowspan="">
139<paragraph role="paragraph" id="par_id3147341" xml-lang="en-US" l10n="U" oldref="32">Single floating-point variable</paragraph>
140</tablecell>
141</tablerow>
142<tablerow>
143<tablecell colspan="" rowspan="">
144<paragraph role="paragraph" id="par_id3155901" xml-lang="en-US" l10n="U" oldref="33">String</paragraph>
145</tablecell>
146<tablecell colspan="" rowspan="">
147<paragraph role="paragraph" id="par_id3155960" xml-lang="en-US" l10n="U" oldref="34">8</paragraph>
148</tablecell>
149<tablecell colspan="" rowspan="">
150<paragraph role="paragraph" id="par_id3146313" xml-lang="en-US" l10n="U" oldref="35">String variable</paragraph>
151</tablecell>
152</tablerow>
153<tablerow>
154<tablecell colspan="" rowspan="">
155<paragraph role="paragraph" id="par_id3145149" xml-lang="en-US" l10n="U" oldref="36">Variant</paragraph>
156</tablecell>
157<tablecell colspan="" rowspan="">
158<paragraph role="paragraph" id="par_id3154021" xml-lang="en-US" l10n="U" oldref="37">12</paragraph>
159</tablecell>
160<tablecell colspan="" rowspan="">
161<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>
162</tablecell>
163</tablerow>
164<tablerow>
165<tablecell colspan="" rowspan="">
166<paragraph role="paragraph" id="par_id3148630" xml-lang="en-US" l10n="U" oldref="39">Empty</paragraph>
167</tablecell>
168<tablecell colspan="" rowspan="">
169<paragraph role="paragraph" id="par_id3152584" xml-lang="en-US" l10n="U" oldref="40">0</paragraph>
170</tablecell>
171<tablecell colspan="" rowspan="">
172<paragraph role="paragraph" id="par_id3151278" xml-lang="en-US" l10n="U" oldref="41">Variable is not initialized</paragraph>
173</tablecell>
174</tablerow>
175<tablerow>
176<tablecell colspan="" rowspan="">
177<paragraph role="paragraph" id="par_id3154576" xml-lang="en-US" l10n="U" oldref="42">Null</paragraph>
178</tablecell>
179<tablecell colspan="" rowspan="">
180<paragraph role="paragraph" id="par_id3166424" xml-lang="en-US" l10n="U" oldref="43">1</paragraph>
181</tablecell>
182<tablecell colspan="" rowspan="">
183<paragraph role="paragraph" id="par_id3145131" xml-lang="en-US" l10n="U" oldref="44">No valid data</paragraph>
184</tablecell>
185</tablerow>
186</table>
187<embed href="text/sbasic/shared/00000003.xhp#errorcode"/>
188<embed href="text/sbasic/shared/00000003.xhp#err5"/>
189<paragraph role="heading" id="hd_id3149338" xml-lang="en-US" level="2" l10n="U" oldref="45">Example:</paragraph>
190<paragraph role="paragraph" id="par_id3150363" xml-lang="en-US" l10n="U" oldref="46">Sub ExampleType</paragraph>
191<paragraph role="paragraph" id="par_id3159088" xml-lang="en-US" l10n="U" oldref="47">Dim iVar As Integer</paragraph>
192<paragraph role="paragraph" id="par_id3150089" xml-lang="en-US" l10n="U" oldref="48">Dim sVar As String</paragraph>
193<paragraph role="paragraph" id="par_id3156139" xml-lang="en-US" l10n="U" oldref="49">Dim siVar As Single</paragraph>
194<paragraph role="paragraph" id="par_id3151217" xml-lang="en-US" l10n="U" oldref="50">Dim dVar As Double</paragraph>
195<paragraph role="paragraph" id="par_id3154658" xml-lang="en-US" l10n="U" oldref="51">Dim bVar As Boolean</paragraph>
196<paragraph role="paragraph" id="par_id3152992" xml-lang="en-US" l10n="U" oldref="52">Dim lVar As Long</paragraph>
197<paragraph role="paragraph" id="par_id3155509" xml-lang="en-US" l10n="U" oldref="53">Msgbox TypeName(iVar) &amp; " " &amp; VarType(iVar) &amp; Chr(13) &amp;_</paragraph>
198<paragraph role="paragraph" id="par_id3150370" xml-lang="en-US" l10n="CHG" oldref="54">TypeName(sVar) &amp; " " &amp; VarType(sVar) &amp; Chr(13) &amp;_</paragraph>
199<paragraph role="paragraph" id="par_id3155532" xml-lang="en-US" l10n="U" oldref="55">TypeName(siVar) &amp; " " &amp; VarType(siVar) &amp; Chr(13) &amp;_</paragraph>
200<paragraph role="paragraph" id="par_id3152988" xml-lang="en-US" l10n="U" oldref="56">TypeName(dVar) &amp; " " &amp; VarType(dVar) &amp; Chr(13) &amp;_</paragraph>
201<paragraph role="paragraph" id="par_id3156166" xml-lang="en-US" l10n="U" oldref="57">TypeName(bVar) &amp; " " &amp; VarType(bVar) &amp; Chr(13) &amp;_</paragraph>
202<paragraph role="paragraph" id="par_id3148817" xml-lang="en-US" l10n="U" oldref="58">TypeName(lVar) &amp; " " &amp; VarType(lVar),0,"Some types in $[officename] Basic"</paragraph>
203<paragraph role="paragraph" id="par_id3154259" xml-lang="en-US" l10n="U" oldref="59">end Sub</paragraph>
204</body>
205</helpdocument>
206