VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
END
Attribute VB_Name = "Diagram"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Public WithEvents appGrabber As Word.Application
Attribute appGrabber.VB_VarHelpID = -1
Public WithEvents docThisWord As Word.Document
Attribute docThisWord.VB_VarHelpID = -1
Public Diagrams As Collection

'Every instance should see this same number
Private iIndexCount As Integer

'Only this instance should see this number
Private iThisIndex As Integer
Private strFilename As String

Public Event Delete(ByVal iIndex As Integer)
Public Event Insert(ByVal strThisFile As String)

Private Sub appGrabber_DocumentChange()
    'Occurs when the user _switches_ documents, not _alters_ them.
End Sub

Private Sub appGrabber_Quit()

End Sub

Private Sub appGrabber_WindowDeactivate(ByVal Doc As Document, ByVal Wn As Window)
    Static iTimes As Integer
    
    iTimes = iTimes + 1
    StatusBar = Str$(iTimes) & " deactivations."

End Sub

Private Sub appGrabber_WindowSelectionChange(ByVal Sel As Selection)
    'Occurs whenever the user consciously moves the cursor
    Static iTimes As Integer
    
    iTimes = iTimes + 1
    StatusBar = Str$(iTimes) & " occurrences."

End Sub

Private Sub Class_Initialize()
    Set docThisWord = Word.ActiveDocument

    iIndexCount = iIndexCount + 1
'    Diagrams.Add Item:=Me, Key:=iIndexCount
    iThisIndex = iIndexCount
End Sub

Private Sub Class_Terminate()
    iIndexCount = iIndexCount - 1
    Diagrams.Remove iThisIndex
End Sub

Public Property Get FileName() As String
    FileName = strFilename
End Property

Public Property Let FileName(strIncoming As String)
    On Error GoTo Invalid1
    If FileSystem.Dir(strIncoming) <> "" Then
        strFilename = strIncoming
    End If
    Exit Property
Invalid1:
End Property

Public Property Get ImageType() As String
    Dim strEndTag As String
    
    strEndTag = Right$(strFilename, Len(strFilename - InStr(strFilename, ".")))
    Select Case strEndTag
        Case "JPG"
            ImageType = "JPEG"
        Case "JPEG"
            ImageType = "JPEG"
        Case "TIF"
            ImageType = "TIFF"
        Case "TIFF"
            ImageType = "TIFF"
        Case "BMP"
            ImageType = "Windows Bitmap"
        Case "GIF"
            ImageType = "GIF"
        Case "WMF"
            ImageType = "Windows Metafile"
    End Select
End Property

Public Property Get Index() As Integer
    Index = iThisIndex
End Property

Public Sub InsertDiagram(strThisFile As String)
    If FileSystem.Dir(strThisFile) <> "" Then
        strFilename = strThisFile
        
    End If
End Sub

Private Sub docThisWord_New()

End Sub
