home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Programmer'…arterly (Limited Edition) / Visual_Basic_Programmers_Journal_VB-CD_Quarterly_Limited_Edition_1995.iso / code / ch18code / document.cls < prev    next >
Encoding:
Text File  |  1995-08-13  |  1.4 KB  |  53 lines

  1. VERSION 1.0 CLASS
  2. BEGIN
  3.   MultiUse = -1  'True
  4. END
  5. Attribute VB_Name = "Document"
  6. Attribute VB_Creatable = False
  7. Attribute VB_Exposed = False
  8. Private mObjBasic As Object
  9. Private mobjWord As Object
  10. Function Create(objOLE, x1, y1, x2, y2) As Object
  11.     ' Add a Word object to the current sheet.
  12.     objOLE.CreateEmbed "", "Word.Document"
  13.     With objOLE
  14.         ' Set the position and size.
  15.         .TOP = x1
  16.         .Left = y1
  17.         .Width = x2 - x1
  18.         .Height = y2 - y1
  19.     End With
  20.     ' Set the internal object variable
  21.     Set mobjWord = objOLE.object
  22.     ' Set the internal object variable.
  23.     Set Me.SetBasic = objOLE.object.Application.Wordbasic
  24.     ' Return the object that was created (same behavior as Excel's Add methods)
  25.     Set Create = mobjWord
  26. End Function
  27.  
  28. Property Set SetBasic(obj As Object)
  29.     ' Check if this is a WordBasic object.
  30.     If TypeName(obj) = "wordbasic" Then
  31.         Set mObjBasic = obj
  32.     Else
  33.         Error 1005
  34.     End If
  35. End Property
  36.  
  37. Property Get Basic() As Object
  38.     ' If there is an object in mobjBasic.
  39.     If IsEmpty(mObjBasic) = False Then
  40.         ' Return the WordBasic object.
  41.         Set Basic = mObjBasic
  42.     Else
  43.         ' No current object, trigger "Unable to get property" error (same as Excel uses).
  44.         Error 1006
  45.     End If
  46. End Property
  47.  
  48. Property Let Basic(obj As Object)
  49.     Set SetBasic = obj
  50. End Property
  51.  
  52.  
  53.