<?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: Automating JMP through visual basic: copying excel data to JMP data tables. in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Automating-JMP-through-visual-basic-copying-excel-data-to-JMP/m-p/107912#M39249</link>
    <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am looking successfully code for automating JMP through visual basic.&lt;/P&gt;&lt;P&gt;Anyone completed that please share it with me. Appreciate on your help on this topic.&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;</description>
    <pubDate>Thu, 24 Jan 2019 08:10:09 GMT</pubDate>
    <dc:creator>AlexDong</dc:creator>
    <dc:date>2019-01-24T08:10:09Z</dc:date>
    <item>
      <title>Automating JMP through visual basic: copying excel data to JMP data tables.</title>
      <link>https://community.jmp.com/t5/Discussions/Automating-JMP-through-visual-basic-copying-excel-data-to-JMP/m-p/49315#M28032</link>
      <description>&lt;P&gt;Hello all,&lt;/P&gt;&lt;P&gt;The script below is supposed to do the following: it runs a VBA code which copies the excel workbook data to JMP tables (using the JMP library jmp.tlb). The first part is intended to load the reference JMP in excel so that functions associated with JMP automation can run. The second part exports all the workboook sheets to JMP data tables. When I run this code I get the following error: User-defined type not defined at the&lt;/P&gt;&lt;DIV&gt;&lt;EM&gt;Dim MyJMP As JMP.Application&lt;/EM&gt; line.&amp;nbsp;If I run the first part alone, the code works: it sets a check mark to the JMP reference (under tools&amp;gt;&amp;gt;references at the VBA editor). If I run the second part (after setting manually the check mark for JMP under tools&amp;gt;&amp;gt;references), it also works. Thus I do not understand what is wrong. Any help appreciated :)&lt;/img&gt; many thanks!&lt;/DIV&gt;&lt;DIV&gt;Eduardo &amp;nbsp;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;Sub export()&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;'Add JMP reference&lt;/DIV&gt;&lt;DIV&gt;'PART 1&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;On Error Resume Next&lt;/DIV&gt;&lt;DIV&gt;Application.VBE.ActiveVBProject.References.AddFromFile _&lt;/DIV&gt;&lt;DIV&gt;"C:\Program Files\SAS\JMP\12\jmp.tlb"&lt;/DIV&gt;&lt;DIV&gt;On Error GoTo 0&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;'This part exports all tabs in the excel workbook to JMP as tables&lt;/DIV&gt;&lt;DIV&gt;'PART 2&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Dim MyJMP As JMP.Application&lt;/DIV&gt;&lt;DIV&gt;Dim JMPdoc As JMP.Document&lt;/DIV&gt;&lt;DIV&gt;Set MyJMP = CreateObject("JMP.Application")&lt;/DIV&gt;&lt;DIV&gt;MyJMP.Visible = True&lt;/DIV&gt;&lt;DIV&gt;Set JMPdoc = MyJMP.OpenDocument(ThisWorkbook.FullName)&lt;/DIV&gt;&lt;DIV&gt;Dim JMPdt As JMP.DataTable&lt;/DIV&gt;&lt;DIV&gt;Set JMPdt = JMPdoc.GetDataTable&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;End Sub&lt;/DIV&gt;</description>
      <pubDate>Fri, 05 Jan 2018 18:10:30 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Automating-JMP-through-visual-basic-copying-excel-data-to-JMP/m-p/49315#M28032</guid>
      <dc:creator>Eduardo</dc:creator>
      <dc:date>2018-01-05T18:10:30Z</dc:date>
    </item>
    <item>
      <title>Re: Automating JMP through visual basic: copying excel data to JMP data tables.</title>
      <link>https://community.jmp.com/t5/Discussions/Automating-JMP-through-visual-basic-copying-excel-data-to-JMP/m-p/50022#M28467</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;I found myself a solution to my problem but then I got another one. What I'm trying to do is as follows: a JMP script calls a VBS script. The VBS script runs an excel add-in. The excel add-in gets a data file, processes it, and generates a workbook. The VBS then continues and introduces in the workbook two macros. One macro is for activating the JMP reference (jmp.tlb) and the second one is for finally exporting all sheets of the workbook as JMP tables. I have attached the JMP code and the VBS code is below (perhaps this is interesting for other people). Now this is how everything runs: the add-in runs, the workbook is created, but then it hangs (Excel displays later: Microsoft excel is waiting for another application to complete an OLE action). Then I tried to change the syntax of my runprogram command: instead of writing Read function ("text"), I wrote Read function (). The whole thing runs (it even pops the "Finished" message from the VBS) but what comes after the runprogram commad is not working. From the moment I run the JMP script, ntables=0. It looks like the JMP script runs the VBS script and runs in parallel what comes after the runprogram command, and since there are no tables at that point, then ntables=0. I don't understand. I guess I'm using the wrong way the runprogram command and that's my problem. Must be something easy but cannot find it. Any help appreciated! thanks!&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;File&amp;nbsp;Call myAddin.vbs&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Set objExcel = CreateObject("Excel.Application")&lt;BR /&gt;Set objWorkbook = objExcel.Workbooks.Open("C:\Users\eduret\AppData\Roaming\Microsoft\AddIns\Gamma Tools.xla")&lt;/P&gt;&lt;P&gt;objExcel.Application.Visible = True&lt;/P&gt;&lt;P&gt;objExcel.Application.Run "'Gamma Tools.xla'!Pics"&lt;/P&gt;&lt;P&gt;Set objWorkbook2 = objExcel.ActiveWorkbook&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Set xlmodule = objworkbook2.VBProject.VBComponents.Add(1)&lt;BR /&gt;strCode = _&lt;BR /&gt;"sub ref()" &amp;amp; vbCr &amp;amp; _&lt;BR /&gt;"On Error Resume Next" &amp;amp; vbCr &amp;amp; _&lt;BR /&gt;"Application.VBE.ActiveVBProject.References.AddFromFile _" &amp;amp; vbCr &amp;amp; _&lt;BR /&gt;"""C:\Program Files\SAS\JMP\12\jmp.tlb""" &amp;amp; vbCr &amp;amp; _&lt;BR /&gt;"On Error GoTo 0" &amp;amp; vbCr &amp;amp; _&lt;BR /&gt;"end sub"&lt;BR /&gt;xlmodule.CodeModule.AddFromString strCode&lt;/P&gt;&lt;P&gt;objExcel.Application.Run "ref"&lt;/P&gt;&lt;P&gt;Set xlmodule = objworkbook2.VBProject.VBComponents.Add(1)&lt;BR /&gt;strCode = _&lt;BR /&gt;"sub export()" &amp;amp; vbCr &amp;amp; _&lt;BR /&gt;"Dim MyJMP As JMP.Application" &amp;amp; vbCr &amp;amp; _&lt;BR /&gt;"Dim JMPdoc As JMP.Document" &amp;amp; vbCr &amp;amp; _&lt;BR /&gt;"Set MyJMP = CreateObject(""JMP.Application"")" &amp;amp; vbCr &amp;amp; _&lt;BR /&gt;"MyJMP.Visible = True" &amp;amp; vbCr &amp;amp; _&lt;BR /&gt;"Set JMPdoc = MyJMP.OpenDocument(ThisWorkbook.FullName)" &amp;amp; vbCr &amp;amp; _&lt;BR /&gt;"Dim JMPdt As JMP.DataTable" &amp;amp; vbCr &amp;amp; _&lt;BR /&gt;"Set JMPdt = JMPdoc.GetDataTable" &amp;amp; vbCr &amp;amp; _&lt;BR /&gt;"end sub"&lt;BR /&gt;xlmodule.CodeModule.AddFromString strCode&lt;/P&gt;&lt;P&gt;objExcel.Application.Run "export"&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;objworkbook2.Save&lt;BR /&gt;objExcel.ActiveWorkbook.Close&lt;BR /&gt;objExcel.Application.Quit&lt;BR /&gt;WScript.Echo "Finished."&lt;BR /&gt;WScript.Quit&lt;/P&gt;</description>
      <pubDate>Tue, 23 Jan 2018 13:19:55 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Automating-JMP-through-visual-basic-copying-excel-data-to-JMP/m-p/50022#M28467</guid>
      <dc:creator>Eduardo</dc:creator>
      <dc:date>2018-01-23T13:19:55Z</dc:date>
    </item>
    <item>
      <title>Re: Automating JMP through visual basic: copying excel data to JMP data tables.</title>
      <link>https://community.jmp.com/t5/Discussions/Automating-JMP-through-visual-basic-copying-excel-data-to-JMP/m-p/50086#M28496</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;I managed to narrow down where the problem lies&lt;/STRONG&gt;. I simplified everything. Now I have a macro-enabled excel workbook with the following macro:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Sub export()&lt;/STRONG&gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp;Dim MyJMP As JMP.Application&lt;BR /&gt;&amp;nbsp; &amp;nbsp;Dim JMPdoc As JMP.Document&lt;BR /&gt;&amp;nbsp; &amp;nbsp;Set MyJMP = CreateObject("JMP.Application")&lt;BR /&gt;&amp;nbsp; &amp;nbsp;MyJMP.Visible = True&lt;BR /&gt;&amp;nbsp; &amp;nbsp;Set JMPdoc = MyJMP.OpenDocument(ThisWorkbook.FullName)&lt;BR /&gt;&lt;STRONG&gt;End Sub&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;If I run this macro &lt;U&gt;from excel&lt;/U&gt;, &lt;/STRONG&gt;it does what it is supposed to do. It exports to JMP the sheets of the workbook as JMP tables.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then I also have the following &lt;STRONG&gt;VBS script&lt;/STRONG&gt; with the following code:&lt;/P&gt;&lt;P&gt;Set objExcel = CreateObject("Excel.Application")&lt;BR /&gt;Set objWorkbook = objExcel.Workbooks.Open("\\vfc1home1\home1\eosorio\Profile\Documents\vbs scripts\test.xlsm")&lt;/P&gt;&lt;P&gt;objExcel.Application.Visible = True&lt;/P&gt;&lt;P&gt;objExcel.Application.Run "ref" &amp;nbsp; &amp;nbsp;---&amp;gt; this loads jmp.tlb&lt;/P&gt;&lt;P&gt;Set objWorkbook2 = objExcel.ActiveWorkbook&lt;/P&gt;&lt;P&gt;objExcel.Application.Run "export" &amp;nbsp;---&amp;gt; this runs the macro that is giving problems &lt;STRONG&gt;if call from my VBS&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;objworkbook2.Save&lt;BR /&gt;objExcel.ActiveWorkbook.Close&lt;BR /&gt;objExcel.Application.Quit&lt;BR /&gt;WScript.Echo "Finished."&lt;BR /&gt;WScript.Quit&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Finally I have the following one line &lt;STRONG&gt;JMP script&lt;/STRONG&gt;:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;rp = RunProgram( Executable( "WSCRIPT.EXE" ), Options( "\!"\\vfc1home1\home1\eosorio\Profile\Documents\vbs scripts\exportJMP.vbs\!"" ),Read function("text"));&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Now this is how everything runs&lt;/STRONG&gt;: I run my &lt;STRONG&gt;JMP script&lt;/STRONG&gt;, it calls my &lt;STRONG&gt;VBS script&lt;/STRONG&gt;, which then finally executes the excel macro &lt;STRONG&gt;export&lt;/STRONG&gt;. But when executing the &lt;STRONG&gt;export macro&lt;/STRONG&gt; the whole thing hangs and excel produces the following message:&amp;nbsp;&lt;STRONG&gt;Microsoft excel is waiting for another application to complete an OLE action....while the wheel on JMP is spinning :)&lt;/img&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Any help super appreciated ! Thanks!&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 24 Jan 2018 10:37:47 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Automating-JMP-through-visual-basic-copying-excel-data-to-JMP/m-p/50086#M28496</guid>
      <dc:creator>Eduardo</dc:creator>
      <dc:date>2018-01-24T10:37:47Z</dc:date>
    </item>
    <item>
      <title>Re: Automating JMP through visual basic: copying excel data to JMP data tables.</title>
      <link>https://community.jmp.com/t5/Discussions/Automating-JMP-through-visual-basic-copying-excel-data-to-JMP/m-p/50298#M28611</link>
      <description>&lt;P&gt;Why not move the export Sub to the VBScript file? It sounds like there are issues with running these two tasks simultaniously.&lt;/P&gt;
&lt;P&gt;You can automate JMP using the COM interface (without the jmp.tlb type library) from within your VBScript. Check out this &lt;A href="https://www.lexjansen.com/nesug/nesug09/ap/AP09.pdf" target="_self"&gt;white paper&lt;/A&gt; for some information about automating JMP in this way, including an example using VBScript.&lt;/P&gt;
&lt;P&gt;However, looking at your program flow, it seems like you are just trying to import the Excel worksheet to a JMP table. If so, you can just use the Open() function to do the import.&lt;/P&gt;</description>
      <pubDate>Fri, 26 Jan 2018 16:46:12 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Automating-JMP-through-visual-basic-copying-excel-data-to-JMP/m-p/50298#M28611</guid>
      <dc:creator>Justin_Chilton</dc:creator>
      <dc:date>2018-01-26T16:46:12Z</dc:date>
    </item>
    <item>
      <title>Re: Automating JMP through visual basic: copying excel data to JMP data tables.</title>
      <link>https://community.jmp.com/t5/Discussions/Automating-JMP-through-visual-basic-copying-excel-data-to-JMP/m-p/107912#M39249</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am looking successfully code for automating JMP through visual basic.&lt;/P&gt;&lt;P&gt;Anyone completed that please share it with me. Appreciate on your help on this topic.&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Thu, 24 Jan 2019 08:10:09 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Automating-JMP-through-visual-basic-copying-excel-data-to-JMP/m-p/107912#M39249</guid>
      <dc:creator>AlexDong</dc:creator>
      <dc:date>2019-01-24T08:10:09Z</dc:date>
    </item>
    <item>
      <title>Re: Automating JMP through visual basic: copying excel data to JMP data tables.</title>
      <link>https://community.jmp.com/t5/Discussions/Automating-JMP-through-visual-basic-copying-excel-data-to-JMP/m-p/107925#M39256</link>
      <description>&lt;P&gt;Have you read the JMP documentation about automating JMP with Visual Basic? If not, that is the best place to start. (See the Automation&amp;nbsp;Reference PDF in the Documentation folder.) Then see the Samples/Automation folder for example code.&lt;/P&gt;</description>
      <pubDate>Thu, 24 Jan 2019 13:02:29 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Automating-JMP-through-visual-basic-copying-excel-data-to-JMP/m-p/107925#M39256</guid>
      <dc:creator>Mark_Bailey</dc:creator>
      <dc:date>2019-01-24T13:02:29Z</dc:date>
    </item>
    <item>
      <title>Re: Automating JMP through visual basic: copying excel data to JMP data tables.</title>
      <link>https://community.jmp.com/t5/Discussions/Automating-JMP-through-visual-basic-copying-excel-data-to-JMP/m-p/192472#M41153</link>
      <description>&lt;P&gt;I wonder why JMP dont develop a platform to create a customizable windows forms or UI within JMP, the reason why we use VB is because we want to fully automate data extractions, data crunching and data analysis together.&lt;/P&gt;</description>
      <pubDate>Wed, 10 Apr 2019 02:51:17 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Automating-JMP-through-visual-basic-copying-excel-data-to-JMP/m-p/192472#M41153</guid>
      <dc:creator>jerryspilTC</dc:creator>
      <dc:date>2019-04-10T02:51:17Z</dc:date>
    </item>
    <item>
      <title>Re: Automating JMP through visual basic: copying excel data to JMP data tables.</title>
      <link>https://community.jmp.com/t5/Discussions/Automating-JMP-through-visual-basic-copying-excel-data-to-JMP/m-p/192489#M41156</link>
      <description>&lt;P&gt;Select &lt;STRONG&gt;File&lt;/STRONG&gt; &amp;gt; &lt;STRONG&gt;New&lt;/STRONG&gt; &amp;gt; &lt;STRONG&gt;Application&lt;/STRONG&gt;.&lt;/P&gt;</description>
      <pubDate>Wed, 10 Apr 2019 11:34:20 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Automating-JMP-through-visual-basic-copying-excel-data-to-JMP/m-p/192489#M41156</guid>
      <dc:creator>Mark_Bailey</dc:creator>
      <dc:date>2019-04-10T11:34:20Z</dc:date>
    </item>
    <item>
      <title>Re: Automating JMP through visual basic: copying excel data to JMP data tables.</title>
      <link>https://community.jmp.com/t5/Discussions/Automating-JMP-through-visual-basic-copying-excel-data-to-JMP/m-p/192494#M41159</link>
      <description>&lt;P&gt;I will add to&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/5358"&gt;@Mark_Bailey&lt;/a&gt;&amp;nbsp; by pointing you to the documentation on the Application Builder&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp; Help==&amp;gt;Books==&amp;gt;Scripting Guide&lt;/P&gt;
&lt;P&gt;Look for the chapter on "Creating Applications"&lt;/P&gt;
&lt;P&gt;Besides using the Application Builder, the JMP Scripting Language has a full set of Display Objects that allow the building of whatever UI you want.&amp;nbsp; Examples are found in the Sample Scripts and Apps supplied with JMP, and also in the many JMP Addins available in the JMP File Exchange on the JMP Website&lt;/P&gt;</description>
      <pubDate>Wed, 10 Apr 2019 13:44:35 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Automating-JMP-through-visual-basic-copying-excel-data-to-JMP/m-p/192494#M41159</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2019-04-10T13:44:35Z</dc:date>
    </item>
  </channel>
</rss>

