Subscribe Bookmark RSS Feed

Excel VBA - Close JMP data table

jb

Community Trekker

Joined:

Sep 23, 2015

I'm trying to close a JMP data table that was opened via an Excel VBA macro".
 
The Excel VB editor successfully compiles my code (see below).
 
However, when I run it, I get run-time error "Object doesn't support named arguments".
 
The JMP Automation Reference describes the Close method for the Document object as follows:
 
Close(SaveChanges as Boolean, FileName As String)
Closes the document. SaveChanges gives the user the option of specifying a different filename for a final save of the document. If SaveChanges is true, set FileName to the path and name of the file where you want the document saved. If you want to save to the existing document, it is recommended that the Save method be used.
  
Note that I did not see a Close method for the DataTable object.
  
Is there something I'm missing?

 
'------------------------------------
Sub CloseDT()
   Dim app As JMP.Application
   Dim doc As JMP.Document
   Dim dt  As JMP.DataTable
  'Start JMP
  Set app = CreateObject("JMP.Application")
  app.Visible = True
  'Open DT
  Set doc = app.OpenDocument("C:\Program Files\SAS\JMP\11\Samples\Data\Big Class.jmp")
  Set dt = doc.GetDataTable
  dt.Activate
  'Modify DT
  '**********
  'Save and close DT
  doc.Close saveChanges:=True, Filename:="C:\Program Files\SAS\JMP\11\Samples\Data\Big Class.jmp"
End Sub

1 ACCEPTED SOLUTION

Accepted Solutions
Solution

OK, I figured out the VB syntax. I replaced the last line with this:

'Save file

doc.SaveAs "C:\Program Files\SAS\JMP\11\Samples\Data\Big Class.jmp"

'Close file

doc.Close False, ""

1 REPLY
Solution

OK, I figured out the VB syntax. I replaced the last line with this:

'Save file

doc.SaveAs "C:\Program Files\SAS\JMP\11\Samples\Data\Big Class.jmp"

'Close file

doc.Close False, ""