'*********************************************************************** ' Class_Word '*********************************************************************** Private Type this word As word.Application doc As word.Document End Type Dim this As this '======================================================================== ' Class_Initialization '======================================================================== Private Sub Class_Initialize() Set this.word = New word.Application End Sub '======================================================================== ' Class_Terminate '======================================================================== Private Sub Class_Terminate() this.word.Quit End Sub '======================================================================== ' Spellcheck '======================================================================== Public Function Spellcheck(text) Set this.doc = this.word.Documents.Add this.word.Selection.text = text this.word.Dialogs(wdDialogToolsSpellingAndGrammar).Show this.doc.Select text = this.word.Selection.text this.doc.Close wdDoNotSaveChanges End Function '======================================================================== ' Words '======================================================================== Public Function Words(text) Set this.doc = this.word.Documents.Add this.word.Selection.text = text Words = this.word.ActiveDocument.BuiltInDocumentProperties(wdPropertyWords) this.doc.Close wdDoNotSaveChanges End Function '======================================================================== ' Characters '======================================================================== Public Function Characters(text) Set this.doc = this.word.Documents.Add this.word.Selection.text = text Characters = this.word.ActiveDocument.BuiltInDocumentProperties(wdPropertyCharacters) this.doc.Close wdDoNotSaveChanges End Function '======================================================================== ' Lines '======================================================================== Public Function Lines(text) Set this.doc = this.word.Documents.Add this.word.Selection.text = text Lines = this.word.ActiveDocument.BuiltInDocumentProperties(wdPropertyLines) this.doc.Close wdDoNotSaveChanges End Function '======================================================================== ' Sort '======================================================================== Public Function Sort(text) Set this.doc = this.word.Documents.Add this.word.Selection.text = text this.doc.Select this.doc.Range.Sort this.doc.Select Sort = this.word.Selection.text this.doc.Close wdDoNotSaveChanges End Function