<?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: VB code from a 9.3mxd not running in 10 - sort of in ArcObjects SDK Questions</title>
    <link>https://community.esri.com/t5/arcobjects-sdk-questions/vb-code-from-a-9-3mxd-not-running-in-10-sort-of/m-p/414133#M11133</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Jeff, &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for taking a shot, I appreciate the insight.&amp;nbsp; I guess it's that time to write to ESRI and hope sp2 covers this.&amp;nbsp; Have a good one&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Rob&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 15 Dec 2010 17:50:37 GMT</pubDate>
    <dc:creator>RobertFriedel</dc:creator>
    <dc:date>2010-12-15T17:50:37Z</dc:date>
    <item>
      <title>VB code from a 9.3mxd not running in 10 - sort of</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/vb-code-from-a-9-3mxd-not-running-in-10-sort-of/m-p/414131#M11131</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;some code I had written in 9.3 that is embedded in an mxd and is supposed to run when the mxd is opened does not work in 10.&amp;nbsp; It's very simple code, all it does is update a small string of text in the layout with details about the document: name, path, size, etc...&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;When I open the mxd in 10 (SP1) I get the run-time error 91 'object variable or with block variable not set'. But when I go to debug the code, and hit run in the vb editor, all runs fine and the text updates as it should.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm really a hack with arcobjects and I'm sure this is probably a very simple, very easy fix but it's just beyond me.&amp;nbsp; I've attached the mxd for reference.&amp;nbsp; Can anyone shed some light on this?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Rob&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2010 17:04:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/vb-code-from-a-9-3mxd-not-running-in-10-sort-of/m-p/414131#M11131</guid>
      <dc:creator>RobertFriedel</dc:creator>
      <dc:date>2010-12-10T17:04:03Z</dc:date>
    </item>
    <item>
      <title>Re: VB code from a 9.3mxd not running in 10 - sort of</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/vb-code-from-a-9-3mxd-not-running-in-10-sort-of/m-p/414132#M11132</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I reproduced the same behavior you describe. It is caused by this line:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
Private Function MxDocument_OpenDocument() As Boolean
...
&amp;nbsp; Set pEnumElement = pGraphicsContainer.LocateElements(pPoint, 0.2)
...
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;pGraphicsContainer.LocateElements(pPoint, 0.2) is returning null (nothing) when called by OpenDocument().&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;It makes me think the page layout isn't fully initialized before OpenDocument() is triggered. In fact, if you add a 5 second sleep as the first line of the MxDocument_OpenDocument() function, the page layout is blank during that period, and the error still occurs.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Seems like a bug. Maybe an Add-in extension would be better than VBA? (assuming OpenDocument() doesn't exhibit the same behaviour there...).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;-Jeff&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 18:46:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/vb-code-from-a-9-3mxd-not-running-in-10-sort-of/m-p/414132#M11132</guid>
      <dc:creator>JeffreyHamblin</dc:creator>
      <dc:date>2021-12-11T18:46:38Z</dc:date>
    </item>
    <item>
      <title>Re: VB code from a 9.3mxd not running in 10 - sort of</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/vb-code-from-a-9-3mxd-not-running-in-10-sort-of/m-p/414133#M11133</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Jeff, &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for taking a shot, I appreciate the insight.&amp;nbsp; I guess it's that time to write to ESRI and hope sp2 covers this.&amp;nbsp; Have a good one&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Rob&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Dec 2010 17:50:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/vb-code-from-a-9-3mxd-not-running-in-10-sort-of/m-p/414133#M11133</guid>
      <dc:creator>RobertFriedel</dc:creator>
      <dc:date>2010-12-15T17:50:37Z</dc:date>
    </item>
  </channel>
</rss>

