Hi all,
I managed to narrow down where the problem lies. I simplified everything. Now I have a macro-enabled excel workbook with the following macro:
Sub export()
Dim MyJMP As JMP.Application
Dim JMPdoc As JMP.Document
Set MyJMP = CreateObject("JMP.Application")
MyJMP.Visible = True
Set JMPdoc = MyJMP.OpenDocument(ThisWorkbook.FullName)
End Sub
If I run this macro from excel, it does what it is supposed to do. It exports to JMP the sheets of the workbook as JMP tables.
Then I also have the following VBS script with the following code:
Set objExcel = CreateObject("Excel.Application")
Set objWorkbook = objExcel.Workbooks.Open("\\vfc1home1\home1\eosorio\Profile\Documents\vbs scripts\test.xlsm")
objExcel.Application.Visible = True
objExcel.Application.Run "ref" ---> this loads jmp.tlb
Set objWorkbook2 = objExcel.ActiveWorkbook
objExcel.Application.Run "export" ---> this runs the macro that is giving problems if call from my VBS
objworkbook2.Save
objExcel.ActiveWorkbook.Close
objExcel.Application.Quit
WScript.Echo "Finished."
WScript.Quit
Finally I have the following one line JMP script:
rp = RunProgram( Executable( "WSCRIPT.EXE" ), Options( "\!"\\vfc1home1\home1\eosorio\Profile\Documents\vbs scripts\exportJMP.vbs\!"" ),Read function("text"));
Now this is how everything runs: I run my JMP script, it calls my VBS script, which then finally executes the excel macro export. But when executing the export macro the whole thing hangs and excel produces the following message: Microsoft excel is waiting for another application to complete an OLE action....while the wheel on JMP is spinning :)
Any help super appreciated ! Thanks!