home *** CD-ROM | disk | FTP | other *** search
- VERSION 5.00
- Begin VB.Form DocumentForm
- Caption = "SpellDoc Project"
- ClientHeight = 6705
- ClientLeft = 60
- ClientTop = 345
- ClientWidth = 9675
- LinkTopic = "Form1"
- ScaleHeight = 6705
- ScaleWidth = 9675
- StartUpPosition = 3 'Windows Default
- Begin VB.CommandButton Command2
- Caption = "E X I T"
- BeginProperty Font
- Name = "Verdana"
- Size = 9.75
- Charset = 0
- Weight = 700
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 510
- Left = 6960
- TabIndex = 2
- Top = 6090
- Width = 2625
- End
- Begin VB.CommandButton Command1
- Caption = "Spell Check Document"
- BeginProperty Font
- Name = "Verdana"
- Size = 9.75
- Charset = 0
- Weight = 700
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 510
- Left = 4200
- TabIndex = 1
- Top = 6090
- Width = 2625
- End
- Begin VB.TextBox Text1
- BeginProperty Font
- Name = "Verdana"
- Size = 9
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 5730
- Left = 105
- MultiLine = -1 'True
- ScrollBars = 2 'Vertical
- TabIndex = 0
- Text = "DocForm.frx":0000
- Top = 225
- Width = 9480
- End
- Attribute VB_Name = "DocumentForm"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- ' ******************************
- ' ******************************
- ' ** MASTERING VB6 **
- ' ** by Evangelos Petroutos **
- ' ** SYBEX, 1998 **
- ' ******************************
- ' ******************************
- Dim NewInstance As Boolean
- Private Sub Command1_Click()
- Dim DRange As Range
- Me.Caption = "starting word ..."
- On Error Resume Next
- Set AppWord = GetObject(, "Word.Application")
- If AppWord Is Nothing Then
- Set AppWord = CreateObject("Word.Application")
- If AppWord Is Nothing Then
- MsgBox "Could not start Word. Application will end"
- End
- Else
- NewInstance = True
- End If
- Else
- NewInstance = False
- End If
- On Error GoTo ErrorHandler
- AppWord.Documents.Add
- Me.Caption = "checking words..."
- Set DRange = AppWord.ActiveDocument.Range
- DRange.InsertAfter Text1.Text
- Set SpellCollection = DRange.SpellingErrors
- If SpellCollection.Count > 0 Then
- SuggestionsForm.List1.Clear
- SuggestionsForm.List2.Clear
- For iWord = 1 To SpellCollection.Count
- SuggestionsForm!List1.AddItem SpellCollection.Item(iWord)
- If SuggestionsForm!List1.List(SuggestionsForm!List1.NewIndex) = SuggestionsForm!List1.List(SuggestionsForm!List1.NewIndex + 1) Then
- SuggestionsForm!List1.RemoveItem SuggestionsForm!List1.NewIndex
- End If
- Next
- End If
- Me.Caption = "Word VBA Example"
- SuggestionsForm.Show
- Exit Sub
- ErrorHandler:
- MsgBox "The following error occured during the document's spelling" & vbCrLf & Err.Description
- End Sub
- Private Sub Command2_Click()
- End
- End Sub
-