home *** CD-ROM | disk | FTP | other *** search
/ Mastering Visual Basic 6 / mastvb6.iso / ch_code / ch14 / spelldoc / suggform.frm (.txt) < prev   
Encoding:
Visual Basic Form  |  1996-05-16  |  4.5 KB  |  147 lines

  1. VERSION 5.00
  2. Begin VB.Form SuggestionsForm 
  3.    Caption         =   "Word's Spelling Suggestions"
  4.    ClientHeight    =   4620
  5.    ClientLeft      =   60
  6.    ClientTop       =   345
  7.    ClientWidth     =   6000
  8.    LinkTopic       =   "Form2"
  9.    ScaleHeight     =   4620
  10.    ScaleWidth      =   6000
  11.    StartUpPosition =   3  'Windows Default
  12.    Begin VB.CommandButton Command2 
  13.       Caption         =   "R e p l a c e"
  14.       BeginProperty Font 
  15.          Name            =   "Verdana"
  16.          Size            =   11.25
  17.          Charset         =   0
  18.          Weight          =   700
  19.          Underline       =   0   'False
  20.          Italic          =   0   'False
  21.          Strikethrough   =   0   'False
  22.       EndProperty
  23.       Height          =   435
  24.       Left            =   4080
  25.       TabIndex        =   5
  26.       Top             =   3675
  27.       Width           =   1845
  28.    End
  29.    Begin VB.CommandButton Command1 
  30.       Caption         =   "C l o s e"
  31.       BeginProperty Font 
  32.          Name            =   "Verdana"
  33.          Size            =   11.25
  34.          Charset         =   0
  35.          Weight          =   700
  36.          Underline       =   0   'False
  37.          Italic          =   0   'False
  38.          Strikethrough   =   0   'False
  39.       EndProperty
  40.       Height          =   435
  41.       Left            =   4095
  42.       TabIndex        =   2
  43.       Top             =   4155
  44.       Width           =   1845
  45.    End
  46.    Begin VB.ListBox List2 
  47.       BeginProperty Font 
  48.          Name            =   "Verdana"
  49.          Size            =   9
  50.          Charset         =   0
  51.          Weight          =   400
  52.          Underline       =   0   'False
  53.          Italic          =   0   'False
  54.          Strikethrough   =   0   'False
  55.       EndProperty
  56.       Height          =   3000
  57.       Left            =   3045
  58.       TabIndex        =   1
  59.       Top             =   570
  60.       Width           =   2865
  61.    End
  62.    Begin VB.ListBox List1 
  63.       BeginProperty Font 
  64.          Name            =   "Verdana"
  65.          Size            =   9
  66.          Charset         =   0
  67.          Weight          =   400
  68.          Underline       =   0   'False
  69.          Italic          =   0   'False
  70.          Strikethrough   =   0   'False
  71.       EndProperty
  72.       Height          =   3000
  73.       Left            =   60
  74.       Sorted          =   -1  'True
  75.       TabIndex        =   0
  76.       Top             =   570
  77.       Width           =   2865
  78.    End
  79.    Begin VB.Label Label2 
  80.       Caption         =   "Suggested Alternatives"
  81.       BeginProperty Font 
  82.          Name            =   "Verdana"
  83.          Size            =   9.75
  84.          Charset         =   0
  85.          Weight          =   700
  86.          Underline       =   0   'False
  87.          Italic          =   0   'False
  88.          Strikethrough   =   0   'False
  89.       EndProperty
  90.       Height          =   300
  91.       Left            =   3060
  92.       TabIndex        =   4
  93.       Top             =   150
  94.       Width           =   2685
  95.    End
  96.    Begin VB.Label Label1 
  97.       Caption         =   "Words in question"
  98.       BeginProperty Font 
  99.          Name            =   "Verdana"
  100.          Size            =   9.75
  101.          Charset         =   0
  102.          Weight          =   700
  103.          Underline       =   0   'False
  104.          Italic          =   0   'False
  105.          Strikethrough   =   0   'False
  106.       EndProperty
  107.       Height          =   360
  108.       Left            =   90
  109.       TabIndex        =   3
  110.       Top             =   135
  111.       Width           =   2280
  112.    End
  113. Attribute VB_Name = "SuggestionsForm"
  114. Attribute VB_GlobalNameSpace = False
  115. Attribute VB_Creatable = False
  116. Attribute VB_PredeclaredId = True
  117. Attribute VB_Exposed = False
  118. Private Sub Command1_Click()
  119. On Error GoTo CloseError
  120.     AppWord.ActiveDocument.Close False
  121.     If NewInstance Then
  122.         AppWord.Quit
  123.     End If
  124.     Me.Hide
  125.     Exit Sub
  126. CloseError:
  127.     MsgBox "Couldn't close document!"
  128.     Me.Hide
  129. End Sub
  130. Private Sub Command2_Click()
  131.     If List1.ListIndex = -1 Or List2.ListIndex = -1 Then
  132.         MsgBox "Please select a word and an alternate spelling"
  133.         Exit Sub
  134.     End If
  135.     DocumentForm.Text1.Text = Replace(DocumentForm.Text1.Text, List1.Text, List2.Text)
  136. End Sub
  137. Private Sub List1_Click()
  138.     Screen.MousePointer = vbHourglass
  139.     Set CorrectionsCollection = _
  140.         AppWord.GetSpellingSuggestions(List1.Text)
  141.     List2.Clear
  142.     For iSuggWord = 1 To CorrectionsCollection.Count
  143.         List2.AddItem CorrectionsCollection.Item(iSuggWord)
  144.     Next
  145.     Screen.MousePointer = vbDefault
  146. End Sub
  147.