<?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 Robot Structural Analysis 2025-Close Excel Dynamo in Robot Structural Analysis Forum</title>
    <link>https://forums.autodesk.com/t5/robot-structural-analysis-forum/robot-structural-analysis-2025-close-excel-dynamo/m-p/12940185#M2309</link>
    <description>&lt;P&gt;Hello everyone,&amp;nbsp;&lt;BR /&gt;I am trying to use RSA2025 to run dynamo scripts. I am trying to close Excel with the script but I get the following error:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="stefanyC6JZ7_0-1722870458060.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1394518iEF337B1F1E2D2F16/image-size/medium?v=v2&amp;amp;px=400" role="button" title="stefanyC6JZ7_0-1722870458060.png" alt="stefanyC6JZ7_0-1722870458060.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Please find the code from the script below :&lt;/P&gt;&lt;LI-CODE lang="general"&gt;import sys
import clr
import System 

clr.AddReference('Microsoft.Office.Interop.Excel, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c')
from Microsoft.Office.Interop import Excel
from System.Runtime.InteropServices import Marshal

def excel_close(lst_namefile):
    xlApp = Excel.Application(Marshal.GetActiveObject("Excel.Application"))
    print(xlApp)
    allWorkbooks = Excel.Workbooks(xlApp.get_Workbooks())
    print([x for x in allWorkbooks])
    lst_WkbsName = [Excel.Workbook(x).get_Name() for x in allWorkbooks]
    for namefile in lst_namefile:
        if namefile in lst_WkbsName:
            Tesluiten = Excel.Workbook(allWorkbooks.get_Item(namefile))
            Tesluiten.Close()
    xlApp.Quit()

toList = lambda x : x if isinstance(x, list) else [x]
OUT = excel_close(toList(IN[0]))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;Could you please help me solving this issue?&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Best regards,&lt;BR /&gt;Stefany&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 05 Aug 2024 15:13:53 GMT</pubDate>
    <dc:creator>stefanyC6JZ7</dc:creator>
    <dc:date>2024-08-05T15:13:53Z</dc:date>
    <item>
      <title>Robot Structural Analysis 2025-Close Excel Dynamo</title>
      <link>https://forums.autodesk.com/t5/robot-structural-analysis-forum/robot-structural-analysis-2025-close-excel-dynamo/m-p/12940185#M2309</link>
      <description>&lt;P&gt;Hello everyone,&amp;nbsp;&lt;BR /&gt;I am trying to use RSA2025 to run dynamo scripts. I am trying to close Excel with the script but I get the following error:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="stefanyC6JZ7_0-1722870458060.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1394518iEF337B1F1E2D2F16/image-size/medium?v=v2&amp;amp;px=400" role="button" title="stefanyC6JZ7_0-1722870458060.png" alt="stefanyC6JZ7_0-1722870458060.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Please find the code from the script below :&lt;/P&gt;&lt;LI-CODE lang="general"&gt;import sys
import clr
import System 

clr.AddReference('Microsoft.Office.Interop.Excel, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c')
from Microsoft.Office.Interop import Excel
from System.Runtime.InteropServices import Marshal

def excel_close(lst_namefile):
    xlApp = Excel.Application(Marshal.GetActiveObject("Excel.Application"))
    print(xlApp)
    allWorkbooks = Excel.Workbooks(xlApp.get_Workbooks())
    print([x for x in allWorkbooks])
    lst_WkbsName = [Excel.Workbook(x).get_Name() for x in allWorkbooks]
    for namefile in lst_namefile:
        if namefile in lst_WkbsName:
            Tesluiten = Excel.Workbook(allWorkbooks.get_Item(namefile))
            Tesluiten.Close()
    xlApp.Quit()

toList = lambda x : x if isinstance(x, list) else [x]
OUT = excel_close(toList(IN[0]))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;Could you please help me solving this issue?&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Best regards,&lt;BR /&gt;Stefany&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Aug 2024 15:13:53 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/robot-structural-analysis-forum/robot-structural-analysis-2025-close-excel-dynamo/m-p/12940185#M2309</guid>
      <dc:creator>stefanyC6JZ7</dc:creator>
      <dc:date>2024-08-05T15:13:53Z</dc:date>
    </item>
    <item>
      <title>Re: Robot Structural Analysis 2025-Close Excel Dynamo</title>
      <link>https://forums.autodesk.com/t5/robot-structural-analysis-forum/robot-structural-analysis-2025-close-excel-dynamo/m-p/12941661#M2310</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;just to add a little bit extra information.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the full error message&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Message&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;FileNotFoundException : Unable to find assembly ‘Microsoft.Office.Interop.Excel, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c’. at Python.Runtime.CLRModule.AddReference(String name)&lt;/P&gt;&lt;P&gt;at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)&lt;/P&gt;&lt;P&gt;at System.Reflection.MethodBaseInvoker.InvokeDirectByRefWithFewArgs(Object obj, Span`1 copyOfArgs, BindingFlags invokeAttr) [’ File "&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Version Dynamo RSA 2022 runs fine.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="1234eddie_0-1722935596107.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1394783iFA3D8836BBC539C8/image-size/medium?v=v2&amp;amp;px=400" role="button" title="1234eddie_0-1722935596107.png" alt="1234eddie_0-1722935596107.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Version Dynamo RSA 2025&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="1234eddie_1-1722935625716.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1394784iEC9CBEFFFB99004C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="1234eddie_1-1722935625716.png" alt="1234eddie_1-1722935625716.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I hope&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/1218351"&gt;@okapawal&lt;/a&gt;&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/589195"&gt;@Rafal.Gaweda&lt;/a&gt;&amp;nbsp;or maybe others can have a quick look at this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Many thanks in advance&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Gr Edward&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 06 Aug 2024 09:15:05 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/robot-structural-analysis-forum/robot-structural-analysis-2025-close-excel-dynamo/m-p/12941661#M2310</guid>
      <dc:creator>1234eddie</dc:creator>
      <dc:date>2024-08-06T09:15:05Z</dc:date>
    </item>
    <item>
      <title>Re: Robot Structural Analysis 2025-Close Excel Dynamo</title>
      <link>https://forums.autodesk.com/t5/robot-structural-analysis-forum/robot-structural-analysis-2025-close-excel-dynamo/m-p/12941677#M2311</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/3017553"&gt;@1234eddie&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;Can you check or post it n the Dynamo Forum ?&amp;nbsp;&amp;nbsp;&lt;A href="https://forum.dynamobim.com/" target="_blank" rel="noopener"&gt;Dynamo (dynamobim.com)&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;It is rather Dynamo core issue.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 06 Aug 2024 09:23:59 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/robot-structural-analysis-forum/robot-structural-analysis-2025-close-excel-dynamo/m-p/12941677#M2311</guid>
      <dc:creator>okapawal</dc:creator>
      <dc:date>2024-08-06T09:23:59Z</dc:date>
    </item>
  </channel>
</rss>

