VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
END
Attribute VB_Name = "Document"
Attribute VB_Creatable = False
Attribute VB_Exposed = False
Private mObjBasic As Object
Private mobjWord As Object
Function Create(objOLE, x1, y1, x2, y2) As Object
    ' Add a Word object to the current sheet.
    objOLE.CreateEmbed "", "Word.Document"
    With objOLE
        ' Set the position and size.
        .TOP = x1
        .Left = y1
        .Width = x2 - x1
        .Height = y2 - y1
    End With
    ' Set the internal object variable
    Set mobjWord = objOLE.object
    ' Set the internal object variable.
    Set Me.SetBasic = objOLE.object.Application.Wordbasic
    ' Return the object that was created (same behavior as Excel's Add methods)
    Set Create = mobjWord
End Function

Property Set SetBasic(obj As Object)
    ' Check if this is a WordBasic object.
    If TypeName(obj) = "wordbasic" Then
        Set mObjBasic = obj
    Else
        Error 1005
    End If
End Property

Property Get Basic() As Object
    ' If there is an object in mobjBasic.
    If IsEmpty(mObjBasic) = False Then
        ' Return the WordBasic object.
        Set Basic = mObjBasic
    Else
        ' No current object, trigger "Unable to get property" error (same as Excel uses).
        Error 1006
    End If
End Property

Property Let Basic(obj As Object)
    Set SetBasic = obj
End Property


