Software Developer's Kit - ChemDraw

Send comments on this topic
Activate Method
See Also 


Member of ChemDraw Control.Document.

Activates this document.


Visual Basic
Public Sub Activate() 


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
            End If
        End If
        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
    Set myDocument = Nothing
End Sub

See Also