<?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: Export to Image by VBA from outside ArcMap fails in ArcObjects SDK Questions</title>
    <link>https://community.esri.com/t5/arcobjects-sdk-questions/export-to-image-by-vba-from-outside-arcmap-fails/m-p/536173#M14495</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Yeah, it's quite neat to run ArcMap from somewhere else ... the pPageLayout is obtained in other parts of the code, where I check if the ArcMap App is running and if so I get the IMxDoc::PageLayout from this App. This seems to work since if I do something with this pPageLayout - e. g. change the Zoom Factor - in Access ArcMap responds ok. But still - I too have a hunch that this reference to the PageLayout could be the problem but I can't think of another method to verify or change this!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 29 Sep 2011 17:14:55 GMT</pubDate>
    <dc:creator>DanielFuchs</dc:creator>
    <dc:date>2011-09-29T17:14:55Z</dc:date>
    <item>
      <title>Export to Image by VBA from outside ArcMap fails</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/export-to-image-by-vba-from-outside-arcmap-fails/m-p/536169#M14491</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I know a rather similar topic has been around before, but without a really satisfying answer, so I'll try again.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I wrote a short export routine in VBA that simply exports the current PageLayout to a PDF file, and if run from within ArcMap it works fine. But if I put the same function in a module in MSAccess and run it from there it produces a blank page (of the right dimensions, however). All other ArcMap automation run from MSAccess works ok, e. g. if I set the layout zoom factor to 100 or refresh the page layout, that's done. Only the export itself produces a blank page.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The actual code is attached although as I said it's working in ArcMap. I very much hope someone out there has a solution - thanks in advance.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Daniel&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Sep 2011 15:53:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/export-to-image-by-vba-from-outside-arcmap-fails/m-p/536169#M14491</guid>
      <dc:creator>DanielFuchs</dc:creator>
      <dc:date>2011-09-29T15:53:57Z</dc:date>
    </item>
    <item>
      <title>Re: Export to Image by VBA from outside ArcMap fails</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/export-to-image-by-vba-from-outside-arcmap-fails/m-p/536170#M14492</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;If you are attempting to place this code into VBA-Access, and I don't necessarily know the answer to this, but how does it know what an IActiveView or an IPageLayout2 is?&amp;nbsp; Aren't these ArcObjects, specific to ArcGIS?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Sorry I don't have a direct answer, but I am unsure how you could implement any ArcObject into a non-ArcGIS application (Microsoft Access).&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Sep 2011 16:15:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/export-to-image-by-vba-from-outside-arcmap-fails/m-p/536170#M14492</guid>
      <dc:creator>JamesCrandall</dc:creator>
      <dc:date>2011-09-29T16:15:09Z</dc:date>
    </item>
    <item>
      <title>Re: Export to Image by VBA from outside ArcMap fails</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/export-to-image-by-vba-from-outside-arcmap-fails/m-p/536171#M14493</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;James, that's quite easy actually. You only have to check the necessary ArcObject libraries in the Tools - References menu (ESRICarto UI Object library etc.) within the VBA environment in MSAccess and then you can use all ArcObject functions, methods and so on within Access - of course you'll need some ArcMap App that's running at the same time that your code interacts with. All that works - but for the export I mentioned.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Daniel&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Sep 2011 17:01:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/export-to-image-by-vba-from-outside-arcmap-fails/m-p/536171#M14493</guid>
      <dc:creator>DanielFuchs</dc:creator>
      <dc:date>2011-09-29T17:01:42Z</dc:date>
    </item>
    <item>
      <title>Re: Export to Image by VBA from outside ArcMap fails</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/export-to-image-by-vba-from-outside-arcmap-fails/m-p/536172#M14494</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;James, that's quite easy actually. You only have to check the necessary ArcObject libraries in the Tools - References menu (ESRICarto UI Object library etc.) within the VBA environment in MSAccess and then you can use all ArcObject functions, methods and so on within Access - of course you'll need some ArcMap App that's running at the same time that your code interacts with. All that works - but for the export I mentioned.&lt;BR /&gt;&lt;BR /&gt;Daniel&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;huh.&amp;nbsp; I had no idea.&amp;nbsp; I had to do a double take when I saw all of the ESRI references in the list!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;What's your code that sets the pPageLayout?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Sep 2011 17:05:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/export-to-image-by-vba-from-outside-arcmap-fails/m-p/536172#M14494</guid>
      <dc:creator>JamesCrandall</dc:creator>
      <dc:date>2011-09-29T17:05:39Z</dc:date>
    </item>
    <item>
      <title>Re: Export to Image by VBA from outside ArcMap fails</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/export-to-image-by-vba-from-outside-arcmap-fails/m-p/536173#M14495</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Yeah, it's quite neat to run ArcMap from somewhere else ... the pPageLayout is obtained in other parts of the code, where I check if the ArcMap App is running and if so I get the IMxDoc::PageLayout from this App. This seems to work since if I do something with this pPageLayout - e. g. change the Zoom Factor - in Access ArcMap responds ok. But still - I too have a hunch that this reference to the PageLayout could be the problem but I can't think of another method to verify or change this!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Sep 2011 17:14:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/export-to-image-by-vba-from-outside-arcmap-fails/m-p/536173#M14495</guid>
      <dc:creator>DanielFuchs</dc:creator>
      <dc:date>2011-09-29T17:14:55Z</dc:date>
    </item>
    <item>
      <title>Re: Export to Image by VBA from outside ArcMap fails</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/export-to-image-by-vba-from-outside-arcmap-fails/m-p/536174#M14496</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Yeah, it's quite neat to run ArcMap from somewhere else ... the pPageLayout is obtained in other parts of the code, where I check if the ArcMap App is running and if so I get the IMxDoc::PageLayout from this App. This seems to work since if I do something with this pPageLayout - e. g. change the Zoom Factor - in Access ArcMap responds ok. But still - I too have a hunch that this reference to the PageLayout could be the problem but I can't think of another method to verify or change this!&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Just check to make sure of something like... if the Set pPageLayout = ActiveView or something to that effect.&amp;nbsp; I mean, what if the active view was not the LayoutView?&amp;nbsp; Or does it interperet the activeView as something within Access?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I really don't know.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Sep 2011 17:21:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/export-to-image-by-vba-from-outside-arcmap-fails/m-p/536174#M14496</guid>
      <dc:creator>JamesCrandall</dc:creator>
      <dc:date>2011-09-29T17:21:21Z</dc:date>
    </item>
    <item>
      <title>Re: Export to Image by VBA from outside ArcMap fails</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/export-to-image-by-vba-from-outside-arcmap-fails/m-p/536175#M14497</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Your code is not running inside of ArcMap.&amp;nbsp; Therefore, any ArcObjects you create using the NEW keyword are created outside of ArcMap's process space.&amp;nbsp; ArcObjects are single apartment threaded, meaning they will not marshal correctly across process boundaries.&amp;nbsp; In order to work correctly, you will need to create all instances of the ArcObjects you're using inside of ArcMap's process space.&amp;nbsp; This can be done by using IObjectFactory.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Sep 2011 21:16:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/export-to-image-by-vba-from-outside-arcmap-fails/m-p/536175#M14497</guid>
      <dc:creator>NeilClemmons</dc:creator>
      <dc:date>2011-09-29T21:16:45Z</dc:date>
    </item>
    <item>
      <title>Re: Export to Image by VBA from outside ArcMap fails</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/export-to-image-by-vba-from-outside-arcmap-fails/m-p/536176#M14498</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Your code is not running inside of ArcMap.&amp;nbsp; Therefore, any ArcObjects you create using the NEW keyword are created outside of ArcMap's process space.&amp;nbsp; ArcObjects are single apartment threaded, meaning they will not marshal correctly across process boundaries.&amp;nbsp; In order to work correctly, you will need to create all instances of the ArcObjects you're using inside of ArcMap's process space.&amp;nbsp; This can be done by using IObjectFactory.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Neil, thanks for your reply. I have never used the IObjectFactory before, and there's one thing I don't quite understand. In my example there's quite a lot of ArcObjects that are created with the NEW keyword within MSAccess (in other parts of the code that's got nothing to do with exporting an image) and they all seem to work correctly. One thing I did not mention is that in our case MSAccess and ArcMap are always running at the same time - is this relevant for the question if one has to use the IObjectFactory? If not: do you have an idea where it will be necessary to use an IObjectFactory - to get the pPageLayout (which for some cases seems to work ok, e. g. when refreshing the LayoutView) or to get the New IExport? Thanks again, Daniel&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 Sep 2011 07:25:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/export-to-image-by-vba-from-outside-arcmap-fails/m-p/536176#M14498</guid>
      <dc:creator>DanielFuchs</dc:creator>
      <dc:date>2011-09-30T07:25:17Z</dc:date>
    </item>
    <item>
      <title>Re: Export to Image by VBA from outside ArcMap fails</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/export-to-image-by-vba-from-outside-arcmap-fails/m-p/536177#M14499</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Neil is right.&amp;nbsp; New objects will work in the MSAccess workspace factory in some cases.&amp;nbsp; For exampl,e you could create a new featurelayer, set its featureclass, name, symbols, etc.&amp;nbsp; even save it as an lyr file, no problem.&amp;nbsp; Try adding that layer to an ArcMap running in a different process, many many problems.&amp;nbsp; If you are only interacting with a object in the local MSAccess memory space, new is the way to go.&amp;nbsp; Technically if you are just calling some method with literal values, strings, integers, booleans, everything &lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;should &lt;/SPAN&gt;&lt;SPAN&gt;be ok because you are not passing references to objects so the values get copied to the new process.&amp;nbsp; If the object has to interact with objects in another memory space, such as ArcMap, ObjectFactory is the only way to go.&amp;nbsp; You don't have the code posted but I suspect you create some object that interact with the pagelayout, if you create those objects in the MSAccess process, they have to go cross process to ArcMap to get the pagelayout, that is when bad things happen.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 Sep 2011 13:43:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/export-to-image-by-vba-from-outside-arcmap-fails/m-p/536177#M14499</guid>
      <dc:creator>AlexanderGray</dc:creator>
      <dc:date>2011-09-30T13:43:34Z</dc:date>
    </item>
    <item>
      <title>Re: Export to Image by VBA from outside ArcMap fails</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/export-to-image-by-vba-from-outside-arcmap-fails/m-p/536178#M14500</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Alexander, thanks for the clarification. I had the code posted in my original post, and from what you tell me I suspect the problem might occur when I set a NEW ExportPDF. At the moment I wrote a workaround where the exporting sub stays within ArcMap and is triggered from MSAccess by a IVbaApplication.RunVBAMacro line, and this works. Unfortunately, I have to deal with other projects for the next few days but I'll come back to that and I'll try the IObjectFactory then. Thanks to all.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 Sep 2011 14:15:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/export-to-image-by-vba-from-outside-arcmap-fails/m-p/536178#M14500</guid>
      <dc:creator>DanielFuchs</dc:creator>
      <dc:date>2011-09-30T14:15:00Z</dc:date>
    </item>
    <item>
      <title>Re: Export to Image by VBA from outside ArcMap fails</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/export-to-image-by-vba-from-outside-arcmap-fails/m-p/536179#M14501</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Neil is right factories are right way to use ArcObjects when outside ArcMap thread.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;You can not acquire valid IApplication if ArcMap is not running which is not a problem in this case.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I&amp;nbsp; didn't experimented much with inter process communication but for clear&amp;nbsp; approach in using ArcObjects I suggest for you to create tool within ArcMap that will do the job for you and return you result.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;But anyway, this piece of code will acquire for you IApplication reference&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;Type t = Type.GetTypeFromProgID("esriFramework.AppRef");
System.Object obj = Activator.CreateInstance(t);
ESRI.ArcGIS.Framework.IApplication pApp = obj as&amp;nbsp; ESRI.ArcGIS.Framework.IApplication;&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards Dubravko&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 23:17:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/export-to-image-by-vba-from-outside-arcmap-fails/m-p/536179#M14501</guid>
      <dc:creator>DubravkoAntonic</dc:creator>
      <dc:date>2021-12-11T23:17:25Z</dc:date>
    </item>
    <item>
      <title>Re: Export to Image by VBA from outside ArcMap fails</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/export-to-image-by-vba-from-outside-arcmap-fails/m-p/536180#M14502</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;I know a rather similar topic has been around before, but without a really satisfying answer, so I'll try again.&lt;BR /&gt;&lt;BR /&gt;I wrote a short export routine in VBA that simply exports the current PageLayout to a PDF file, and if run from within ArcMap it works fine. But if I put the same function in a module in MSAccess and run it from there it produces a blank page (of the right dimensions, however). All other ArcMap automation run from MSAccess works ok, e. g. if I set the layout zoom factor to 100 or refresh the page layout, that's done. Only the export itself produces a blank page.&lt;BR /&gt;&lt;BR /&gt;The actual code is attached although as I said it's working in ArcMap. I very much hope someone out there has a solution - thanks in advance.&lt;BR /&gt;&lt;BR /&gt;Daniel&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;When you export to a PDF in ArcMap the program uses the drivers from your default printer to "print" to the PDF.&amp;nbsp; If you have your default printer set to an XPS document writer or anything other than a physical printer, it will produce a blank document of the right dimensions exactly like you've described.&amp;nbsp; Try setting your default printer in MSAccess to the printer or plotter you use for ArcMap.&amp;nbsp; It may go through the same process as ArcMap.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Oct 2011 13:49:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/export-to-image-by-vba-from-outside-arcmap-fails/m-p/536180#M14502</guid>
      <dc:creator>JacelyneJanoka</dc:creator>
      <dc:date>2011-10-06T13:49:20Z</dc:date>
    </item>
  </channel>
</rss>

