summaryrefslogtreecommitdiffstats
path: root/source/text/sbasic/shared/03090401.xhp
blob: 662580d9610d332f517194452b8ffb61881e8960 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?xml version="1.0" encoding="UTF-8"?>
<!--
 * This file is part of the LibreOffice project.
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 *
 * This file incorporates work covered by the following license notice:
 *
 *   Licensed to the Apache Software Foundation (ASF) under one or more
 *   contributor license agreements. See the NOTICE file distributed
 *   with this work for additional information regarding copyright
 *   ownership. The ASF licenses this file to you under the Apache
 *   License, Version 2.0 (the "License"); you may not use this file
 *   except in compliance with the License. You may obtain a copy of
 *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
 -->
<helpdocument version="1.0">
<meta>
<topic id="textsbasicshared03090401xml" indexer="include" status="PUBLISH">
<title id="tit" xml-lang="en-US">Call Statement</title>
<filename>/text/sbasic/shared/03090401.xhp</filename>
</topic>
<history>
<created date="2003-10-31T00:00:00">Sun Microsystems, Inc.</created>
</history>
</meta>
<body>
<section id="call">
<bookmark xml-lang="en-US" branch="index" id="bm_id3154422"><bookmark_value>Call statement</bookmark_value>
</bookmark>
<paragraph role="heading" id="hd_id3154422" xml-lang="en-US" level="1"><link href="text/sbasic/shared/03090401.xhp" name="Call Statement">Call Statement</link></paragraph>
<paragraph role="paragraph" id="par_id3153394" xml-lang="en-US">Transfers the control of the program to a subroutine, a function, or a procedure of a <link href="text/sbasic/shared/03090403.xhp" name="Dynamic Link Library">Dynamic Link Library (DLL)</link>. The keyword, type and number of parameters is dependent on the routine that is being called.</paragraph>
</section>
<paragraph role="heading" id="hd_id3153345" xml-lang="en-US" level="2">Syntax:</paragraph>
<paragraph role="paragraph" id="par_id491585753339474">
  <image src="media/helpimg/sbasic/Call_statement.svg" id="img_id4156296484514"><alt xml-lang="en-US" id="alt_id15152796484514">Call Statement diagram</alt></image></paragraph>
<bascode>
<paragraph role="bascode" id="par_id3150984" xml-lang="en-US">[Call] name [(] [param :=] value, ... [)] </paragraph>
</bascode>
<paragraph role="heading" id="hd_id3150771" xml-lang="en-US" level="2">Parameters:</paragraph>
<paragraph role="paragraph" id="par_id3148473" xml-lang="en-US">
<emph>name:</emph> Name of the subroutine, the function, or the <link href="text/sbasic/shared/03090403.xhp" name="Dynamic Link Library">DLL</link> that you want to call</paragraph>
<paragraph role="paragraph" id="par_id3148946" xml-lang="en-US">
<emph>param:</emph> Keyword parameter name to pass to the routine, followed by its <emph>value</emph>. The name must match the routine declaration. Keywords are optional and can be used in any order. </paragraph>
<paragraph role="paragraph" id="par_id871586190690812"><emph>value:</emph> Positional parameter value. The type is dependent on the routine that is being called</paragraph>
<note id="par_id421586006407428" xml-lang="en-US">When mixing positional and keyword parameters, make sure positional parameters are following the routine declaration order.</note>
<tip id="par_id3154216" xml-lang="en-US">When a function is used as an expression, enclosing parameters with brackets becomes necessary. Using a <link href="text/sbasic/shared/03090403.xhp" name="Declare Statement">Declare statement</link> is compulsory prior to call a DLL.</tip>
<paragraph role="heading" id="hd_id3125865" xml-lang="en-US" level="2">Example:</paragraph>
<bascode>
<paragraph role="bascode" id="par_id3159254" xml-lang="en-US" localize="false">Sub ExampleCall</paragraph>
<paragraph role="bascode" id="par_id3161832" xml-lang="en-US" localize="false">    Dim value As String</paragraph>
<paragraph role="bascode" id="par_id3147317" xml-lang="en-US" localize="false">    value = "LibreOffice"</paragraph>
<paragraph role="bascode" id="par_id3145273" xml-lang="en-US" localize="false">    Call aRoutine value</paragraph>
<paragraph role="bascode" id="bas_id181585749262948" xml-lang="en-US" localize="false">    aRoutine text := value</paragraph>
<paragraph role="bascode" id="par_id3147435" xml-lang="en-US" localize="false">End Sub</paragraph>
<paragraph role="bascode" id="par_id3147436" xml-lang="en-US" localize="false"></paragraph>
<paragraph role="bascode" id="par_id3155414" xml-lang="en-US" localize="false">Sub aRoutine (text as String)</paragraph>
<paragraph role="bascode" id="par_id3151112" xml-lang="en-US" localize="false">    Msgbox text</paragraph>
<paragraph role="bascode" id="par_id3148646" xml-lang="en-US" localize="false">End Sub</paragraph>
</bascode>
</body>
</helpdocument>