VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
END
Attribute VB_Name = "Application"
Attribute VB_Creatable = True
Attribute VB_Exposed = True
Option Explicit

' Inserts WordArt text in an OLE control.
Public Sub InsertText(strText As String)
    ' Using the WordArt object on frmWordArt
    With frmWordArt.oleWordArt
        ' Set the data format to text.
        ' Make sure application is running.
        .AppIsRunning = True
        .Format = "CF_TEXT"
        .DataText = strText
        .UPDATE
        .Close
    End With
End Sub

Public Property Set Object(objTarget)
    ' Using the WordArt object on frmWordArt
    With frmWordArt.oleWordArt
        ' Activate the object, hiding the running application.
        .DoVerb -3
        ' Copy the object to the Clipboard.
        .Copy
        ' Paste the object into the OLE target.
        objTarget.Paste
        ' Close the object.
        .Close
    End With
End Property

Public Sub CopyObject()
    ' Activate the object
    frmWordArt.oleWordArt.AppIsRunning = True
    ' Copy the object.
    frmWordArt.oleWordArt.Copy
    ' Close it.
    frmWordArt.oleWordArt.Close
End Sub

Public Sub Rotate(oleObject As Object, iDegrees As Integer)
    ' Check if OLE object is Word Art.
    If oleObject.Class = "MSWordArt.2" Then
    ' Activate the object, hiding the running application.
    oleObject.DoVerb -1
    ' Pause to let the OLE application load.
    On Error Resume Next
    Do
        Err = 0
        DoEvents
        ' Activate the OLE application.
        AppActivate "WordArt 2.0 - WordArt 2.0 object in", False
    Loop While Err = 5
    On Error GoTo 0
    SendKeys "%R{TAB 2} ", True
    SendKeys Str(iDegrees) & "{Enter}", True
    SendKeys "{Esc}", True
    oleObject.UPDATE
    End If
End Sub

