Software Developer's Kit - ChemDraw

Send comments on this topic
Close Method
See Also 
saveChanges
Indicates whether changes will be saved or not
Filename
indicates file name

Description

Member of ChemDraw Control.Document.

Closes this document.

Syntax

Visual Basic
Public Sub Close( _
   Optional ByRef saveChanges As Variant, _
   Optional ByRef Filename As Variant _
) 

Parameters

saveChanges
Indicates whether changes will be saved or not
Filename
indicates file name

Example

Dim myDocument As Document

Private Sub Form_Load() 
   'opens and sets document
    Set myDocument = ctlChemDraw.ActiveDocument
End Sub
Private Sub Form_QueryUnload(Cancel As Integer, Unload Mode As Integer)
   If   myDocument.FullName <> "" Then
        If  ctlChemDraw.ActiveDocument.Modified = True Then
            msg = MsgBox("Document has been modified." & Chr(13) & "Save changes?", _
                  vbQuestion + vbYesNo, "Modification") 
            If  msg = 1 Then
                myDocument.Save
            End If
        End If
    Else 
        msg = MsgBox("Document has not been saved." & Chr(13) & "Save data?", _
              vbQuestion + vbYesNo, "New") 
        If  msg = 1 Then
            myDocument.SaveAs CurDir() & "\FileName1.cdx", cdx
        End If
    End If
    myDocument.Close  
    Set myDocument = Nothing
End Sub

See Also