Software Developer's Kit - ChemDraw

Send comments on this topic
Activate Method
See Also 

Description

Member of ChemDraw Control.Document.

Activates this document.

Syntax

Visual Basic
Public Sub Activate() 

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