<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Problem with Eval() function in ArcObjects SDK Questions</title>
    <link>https://community.esri.com/t5/arcobjects-sdk-questions/problem-with-eval-function/m-p/617347#M16546</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Neil,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I had a play with the eval() function and was able to replicate the issue you have. For what it's worth I couldn't work out how to get it to call the function, it must be quirk of VBA in ArcMap.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Duncan&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 11 Jan 2012 10:05:55 GMT</pubDate>
    <dc:creator>DuncanHornby</dc:creator>
    <dc:date>2012-01-11T10:05:55Z</dc:date>
    <item>
      <title>Problem with Eval() function</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/problem-with-eval-function/m-p/617346#M16545</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I wonder if someone can point out where I'm going wrong here.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm trying to use the Eval() function from Microsoft Access in Arc9.3 vba environment.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I have a brand new mxd with the Microsoft Access object library referenced and all functions are in a standard module. A simple test as follows, as per the msdn example (and what works in Access):&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;
Public Function SHLtest()
Dim fncXXX As String
fncXXX = "fncTest()"
Eval (fncXXX)
End Function

Public Function fncTest()
MsgBox "fncTest"
fncTest = True
End Function&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This does not work - get Runtime error 2425 (function name can't be found)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;However, the below does work, where the function name is just passed in without any quotes etc (i.e. it looks like a variable name but is treated as a string):&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;Public Function SHLtest() '''works
Eval (fncTest)
End Function

Public Function fncTest()
MsgBox "fncTest"
fncTest = true
End Function&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Does the Eval() just not work this way in Arcmap vba, or have&amp;nbsp; I fundamentally misunderstood something, made a dumb error etc?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;As an aside, I want to use the Eval function to call procedures where the procedure name is a variable. A user interaction results in a procedure name (and parameters) being passed in from an Access table and I then want that procedure to be executed via the Eval function. Maybe someone can suggest a better way&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;many thanks&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Neil&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 Jan 2012 10:26:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/problem-with-eval-function/m-p/617346#M16545</guid>
      <dc:creator>NeilWebber</dc:creator>
      <dc:date>2012-01-09T10:26:11Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with Eval() function</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/problem-with-eval-function/m-p/617347#M16546</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Neil,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I had a play with the eval() function and was able to replicate the issue you have. For what it's worth I couldn't work out how to get it to call the function, it must be quirk of VBA in ArcMap.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Duncan&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Jan 2012 10:05:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/problem-with-eval-function/m-p/617347#M16546</guid>
      <dc:creator>DuncanHornby</dc:creator>
      <dc:date>2012-01-11T10:05:55Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with Eval() function</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/problem-with-eval-function/m-p/617348#M16547</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks for your input Duncan - good to know it's not just me.&amp;nbsp; I have reverted to using the IVbaApplication.RunVBAMacro method to achieve what I want.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Although I do still wonder why Eval() behaves like that in Arcmap VBA.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;--Neil&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Jan 2012 11:11:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/problem-with-eval-function/m-p/617348#M16547</guid>
      <dc:creator>NeilWebber</dc:creator>
      <dc:date>2012-01-12T11:11:52Z</dc:date>
    </item>
  </channel>
</rss>

