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 / ch15code / applicat.cls < prev    next >
Encoding:
Text File  |  1995-08-12  |  1.8 KB  |  68 lines

  1. VERSION 1.0 CLASS
  2. BEGIN
  3.   MultiUse = -1  'True
  4. END
  5. Attribute VB_Name = "Application"
  6. Attribute VB_Creatable = True
  7. Attribute VB_Exposed = True
  8. Option Explicit
  9.  
  10. ' Inserts WordArt text in an OLE control.
  11. Public Sub InsertText(strText As String)
  12.     ' Using the WordArt object on frmWordArt
  13.     With frmWordArt.oleWordArt
  14.         ' Set the data format to text.
  15.         ' Make sure application is running.
  16.         .AppIsRunning = True
  17.         .Format = "CF_TEXT"
  18.         .DataText = strText
  19.         .UPDATE
  20.         .Close
  21.     End With
  22. End Sub
  23.  
  24. Public Property Set Object(objTarget)
  25.     ' Using the WordArt object on frmWordArt
  26.     With frmWordArt.oleWordArt
  27.         ' Activate the object, hiding the running application.
  28.         .DoVerb -3
  29.         ' Copy the object to the Clipboard.
  30.         .Copy
  31.         ' Paste the object into the OLE target.
  32.         objTarget.Paste
  33.         ' Close the object.
  34.         .Close
  35.     End With
  36. End Property
  37.  
  38. Public Sub CopyObject()
  39.     ' Activate the object
  40.     frmWordArt.oleWordArt.AppIsRunning = True
  41.     ' Copy the object.
  42.     frmWordArt.oleWordArt.Copy
  43.     ' Close it.
  44.     frmWordArt.oleWordArt.Close
  45. End Sub
  46.  
  47. Public Sub Rotate(oleObject As Object, iDegrees As Integer)
  48.     ' Check if OLE object is Word Art.
  49.     If oleObject.Class = "MSWordArt.2" Then
  50.     ' Activate the object, hiding the running application.
  51.     oleObject.DoVerb -1
  52.     ' Pause to let the OLE application load.
  53.     On Error Resume Next
  54.     Do
  55.         Err = 0
  56.         DoEvents
  57.         ' Activate the OLE application.
  58.         AppActivate "WordArt 2.0 - WordArt 2.0 object in", False
  59.     Loop While Err = 5
  60.     On Error GoTo 0
  61.     SendKeys "%R{TAB 2} ", True
  62.     SendKeys Str(iDegrees) & "{Enter}", True
  63.     SendKeys "{Esc}", True
  64.     oleObject.UPDATE
  65.     End If
  66. End Sub
  67.  
  68.