# GrapeCity.Spreadsheet.INames.AddExternalVariable

## Content

<div class="doc-site-dotnet-api-container">



<h1 id="GrapeCity_Spreadsheet_INames_AddExternalVariable_" data-uid="GrapeCity.Spreadsheet.INames.AddExternalVariable*">AddExternalVariable Method
</h1>
<div class="markdown level0 summary"></div>
<div class="markdown level0 conceptual"></div>



<a id="GrapeCity_Spreadsheet_INames_AddExternalVariable_" data-uid="GrapeCity.Spreadsheet.INames.AddExternalVariable*"></a>
<h4 id="GrapeCity_Spreadsheet_INames_AddExternalVariable_System_String_System_String_" data-uid="GrapeCity.Spreadsheet.INames.AddExternalVariable(System.String,System.String)">AddExternalVariable(string, string)</h4>
<div class="markdown level1 summary"><p>Creates a external variable.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">ExternalVariable AddExternalVariable(string name, string formula)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Function AddExternalVariable(name As String, formula As String) As ExternalVariable</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Type</th>
      <th>Name</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></td>
      <td><span class="parametername">name</span></td>
      <td><p>A string value indicates the external variable name.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></td>
      <td><span class="parametername">formula</span></td>
      <td><p>A string value indicates the associated formula.</p>
</td>
    </tr>
  </tbody>
</table>
<h5 class="returns">Returns</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Type</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><a class="xref" href="GrapeCity.Spreadsheet.ExternalVariable.html">ExternalVariable</a></td>
      <td><p>A <a class="xref" href="GrapeCity.Spreadsheet.ExternalVariable.html">ExternalVariable</a> object indicates the new external variable.</p>
</td>
    </tr>
  </tbody>
</table>


<a id="GrapeCity_Spreadsheet_INames_AddExternalVariable_" data-uid="GrapeCity.Spreadsheet.INames.AddExternalVariable*"></a>
<h4 id="GrapeCity_Spreadsheet_INames_AddExternalVariable__1_System_String_System_String_" data-uid="GrapeCity.Spreadsheet.INames.AddExternalVariable``1(System.String,System.String)">AddExternalVariable&lt;T&gt;(string, string)</h4>
<div class="markdown level1 summary"><p>Creates a external variable.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">T AddExternalVariable&lt;T&gt;(string name, string formula) where T : ExternalVariable, new()</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Function AddExternalVariable(Of T As {ExternalVariable, New})(name As String, formula As String) As T</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Type</th>
      <th>Name</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></td>
      <td><span class="parametername">name</span></td>
      <td><p>A string value indicates the external variable name.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></td>
      <td><span class="parametername">formula</span></td>
      <td><p>A string value indicates the associated formula.</p>
</td>
    </tr>
  </tbody>
</table>
<h5 class="returns">Returns</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Type</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><span class="xref">T</span></td>
      <td><p>A &lt;T&gt; object indicates the new external variable.</p>
</td>
    </tr>
  </tbody>
</table>
<h5 class="typeParameters">Type Parameters</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Name</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><span class="parametername">T</span></td>
      <td><p>The external variable type that implement <a class="xref" href="GrapeCity.Spreadsheet.ExternalVariable.html">ExternalVariable</a>.</p>
</td>
    </tr>
  </tbody>
</table>


<a id="GrapeCity_Spreadsheet_INames_AddExternalVariable_" data-uid="GrapeCity.Spreadsheet.INames.AddExternalVariable*"></a>
<h4 id="GrapeCity_Spreadsheet_INames_AddExternalVariable_System_String_GrapeCity_Spreadsheet_ExternalVariable_System_String_" data-uid="GrapeCity.Spreadsheet.INames.AddExternalVariable(System.String,GrapeCity.Spreadsheet.ExternalVariable,System.String)">AddExternalVariable(string, ExternalVariable, string)</h4>
<div class="markdown level1 summary"><p>Creates a external variable.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">bool AddExternalVariable(string name, ExternalVariable externalVariable, string formula = null)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Function AddExternalVariable(name As String, externalVariable As ExternalVariable, Optional formula As String = Nothing) As Boolean</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Type</th>
      <th>Name</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></td>
      <td><span class="parametername">name</span></td>
      <td><p>A string value indicates the external variable name.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="GrapeCity.Spreadsheet.ExternalVariable.html">ExternalVariable</a></td>
      <td><span class="parametername">externalVariable</span></td>
      <td><p>A <a class="xref" href="GrapeCity.Spreadsheet.ExternalVariable.html">ExternalVariable</a> object indicates the external variable name to add.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></td>
      <td><span class="parametername">formula</span></td>
      <td><p>A string value indicates the associated formula.</p>
</td>
    </tr>
  </tbody>
</table>
<h5 class="returns">Returns</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Type</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.boolean">bool</a></td>
      <td><p><code>true</code> if the <code class="paramref">externalVariable</code> object is added successful; otherwise, <code>false</code>.</p>
</td>
    </tr>
  </tbody>
</table>
</div>
