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