<?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: Programming a loop to seek specific cells from an excel file in Mathcad</title>
    <link>https://www.ptcusercommunity.com/t5/Mathcad/Programming-a-loop-to-seek-specific-cells-from-an-excel-file/m-p/588198#M184130</link>
    <description>&lt;P&gt;Thank you Terry for the code. Will try it in Mathcad 15.&lt;/P&gt;
&lt;P&gt;However, I can't share the Excel sheet.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Raiko&lt;/P&gt;</description>
    <pubDate>Wed, 09 Jan 2019 08:10:54 GMT</pubDate>
    <dc:creator>Raiko</dc:creator>
    <dc:date>2019-01-09T08:10:54Z</dc:date>
    <item>
      <title>Programming a loop to seek specific cells from an excel file</title>
      <link>https://www.ptcusercommunity.com/t5/Mathcad/Programming-a-loop-to-seek-specific-cells-from-an-excel-file/m-p/587867#M184105</link>
      <description>&lt;P&gt;Hello folks,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have an Excel sheet in which caloric properties for real gas are calculated. One of the values is only delivered when a VB code is executed in Excel. I strongly suspect that these are in a data map of sorts which is what I'm after. Since I can't access this table (the guy who created this sheet has left long since) I'd like to "push" the appropiate button in Excel from a Mathcad loop repeatedly and read out the data in a specific cell.&lt;/P&gt;
&lt;P&gt;Does anybody know whether this is feasible?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Raiko&lt;/P&gt;</description>
      <pubDate>Mon, 07 Jan 2019 12:22:38 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/Mathcad/Programming-a-loop-to-seek-specific-cells-from-an-excel-file/m-p/587867#M184105</guid>
      <dc:creator>Raiko</dc:creator>
      <dc:date>2019-01-07T12:22:38Z</dc:date>
    </item>
    <item>
      <title>Re: Programming a loop to seek specific cells from an excel file</title>
      <link>https://www.ptcusercommunity.com/t5/Mathcad/Programming-a-loop-to-seek-specific-cells-from-an-excel-file/m-p/588051#M184121</link>
      <description>&lt;P&gt;Hi Raiko&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It&amp;nbsp; is possible to automate&amp;nbsp;both Mathcad and Excel using the API of both.&amp;nbsp; This includes running Excel macros.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;From the web&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;"I&lt;FONT size="3"&gt;&lt;EM&gt;s there any api for executing a macro code of an excel? I don't want to use office interop and I don't want to recode using aspose, I have lot of existing macros I just want to know if there's an api that can do that?&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="3"&gt;&lt;EM&gt;To run a macro, you must create an environment in which the macro can run. To create such an environment you need to automate Excel. You can do this in an Excel add-in or in a standlone application in .NET or in Delphi, VB6, VC++ or other language. After you instantiate the Excel.Application object, you need to call the method it provides - RunMacro."&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The other option is to run the macro by hand and use Mathcad's Readexcel component to&amp;nbsp; read the values into Mathcad.&lt;/P&gt;</description>
      <pubDate>Tue, 08 Jan 2019 08:27:19 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/Mathcad/Programming-a-loop-to-seek-specific-cells-from-an-excel-file/m-p/588051#M184121</guid>
      <dc:creator>terryhendicott</dc:creator>
      <dc:date>2019-01-08T08:27:19Z</dc:date>
    </item>
    <item>
      <title>Re: Programming a loop to seek specific cells from an excel file</title>
      <link>https://www.ptcusercommunity.com/t5/Mathcad/Programming-a-loop-to-seek-specific-cells-from-an-excel-file/m-p/588176#M184128</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;Here is a sample of automating Excel.&amp;nbsp; It enters some values in cells, runs a macro called "test", then fetches a cell value.&lt;/P&gt;
&lt;P&gt;For a sample of automating Mathcad Prime look at "Re: Mathcad Prime Interface / API" in section of Top Kudoed Posts.&lt;/P&gt;
&lt;P&gt;Do you want someone to do the automation for you, if you can share the sheets?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;using System;&lt;BR /&gt;using System.Windows.Forms;&lt;BR /&gt;using Excel = Microsoft.Office.Interop.Excel;&lt;/P&gt;
&lt;P&gt;namespace ExcelMathCad&lt;BR /&gt;{&lt;BR /&gt; public partial class Form1 : Form&lt;BR /&gt; {&lt;BR /&gt; public Form1()&lt;BR /&gt; {&lt;BR /&gt; InitializeComponent();&lt;BR /&gt; }&lt;/P&gt;
&lt;P&gt;private static Excel.Application MyApp = null;&lt;BR /&gt; private static Excel.Workbook MyBook = null;&lt;BR /&gt; private static Excel.Worksheet MySheet = null;&lt;BR /&gt; private int lastRow;&lt;/P&gt;
&lt;P&gt;private void button1_Click(object sender, EventArgs e)&lt;BR /&gt; {&lt;BR /&gt; MyApp = new Excel.Application();&lt;BR /&gt; MyApp.Visible = true;&lt;BR /&gt; MyBook = MyApp.Workbooks.Open(@"D:\\Prime\\Questions\\Book1.xlsm");&lt;BR /&gt; MySheet = (Excel.Worksheet)MyBook.Sheets[1]; // Explicit cast is not required here&lt;BR /&gt; lastRow = MySheet.Cells.SpecialCells(Excel.XlCellType.xlCellTypeLastCell).Row;&lt;/P&gt;
&lt;P&gt;lastRow += 1;&lt;/P&gt;
&lt;P&gt;MySheet.Cells[lastRow, 1] = "Six";&lt;BR /&gt; MySheet.Cells[lastRow, 2] = 14;&lt;BR /&gt; MySheet.Cells[lastRow, 3] = "Test";&lt;BR /&gt; MySheet.Cells[lastRow, 4] = 30.9;&lt;/P&gt;
&lt;P&gt;MyApp.Run("Test");&lt;/P&gt;
&lt;P&gt;double val = MySheet.Cells[1, 4].Value;&lt;/P&gt;
&lt;P&gt;MyBook.Save();&lt;BR /&gt; MyBook.Close();&lt;BR /&gt; MyApp.Quit();&lt;/P&gt;
&lt;P&gt;System.Runtime.InteropServices.Marshal.ReleaseComObject(MySheet);&lt;BR /&gt; MySheet = null;&lt;BR /&gt; System.Runtime.InteropServices.Marshal.ReleaseComObject(MyBook);&lt;BR /&gt; MyBook = null;&lt;BR /&gt; System.Runtime.InteropServices.Marshal.ReleaseComObject(MyApp);&lt;BR /&gt; MyApp = null;&lt;BR /&gt; }&lt;BR /&gt; }&lt;BR /&gt;}&lt;/P&gt;</description>
      <pubDate>Wed, 09 Jan 2019 04:15:25 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/Mathcad/Programming-a-loop-to-seek-specific-cells-from-an-excel-file/m-p/588176#M184128</guid>
      <dc:creator>terryhendicott</dc:creator>
      <dc:date>2019-01-09T04:15:25Z</dc:date>
    </item>
    <item>
      <title>Re: Programming a loop to seek specific cells from an excel file</title>
      <link>https://www.ptcusercommunity.com/t5/Mathcad/Programming-a-loop-to-seek-specific-cells-from-an-excel-file/m-p/588198#M184130</link>
      <description>&lt;P&gt;Thank you Terry for the code. Will try it in Mathcad 15.&lt;/P&gt;
&lt;P&gt;However, I can't share the Excel sheet.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Raiko&lt;/P&gt;</description>
      <pubDate>Wed, 09 Jan 2019 08:10:54 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/Mathcad/Programming-a-loop-to-seek-specific-cells-from-an-excel-file/m-p/588198#M184130</guid>
      <dc:creator>Raiko</dc:creator>
      <dc:date>2019-01-09T08:10:54Z</dc:date>
    </item>
  </channel>
</rss>

