yeungsprite
Programmer
Hi,
I am wondering if anyone can direct me to some help regarding the use of the Spell Check Dialog Box. I would like to access Microsoft Excel's spell checking tool, but instead of clicking 'ok' to change words, I want to modify it so that a list of words can be separated into two lists of 'acceptable' and 'unacceptable' words.
I am familiar with the CheckSpelling calls, and am assuming that the code will be somewhat like the following. It will spell check column 'A' words, and if the user accepts the misspelled word, it will be moved to column 'E':
Dim xlApp As Excel.Application 'Excel-object
Set xlApp = New Excel.Application
xlApp.Application.Visible = visibleFiles
Dim aRange As Range ' Column in which to read values from
Dim i As Range ' value of the current cell
Dim icounter As Integer ' keeps track of cell to move incorrect words to
icounter = 1
Set aRange = xlApp.Range("A1", xlApp.ActiveSheet.Cells.SpecialCells(xlLastCell))
For Each i In aRange
' chk for end of range
If i = "" Then
Exit For
End If
' true if word is incorrect
If Not Application.CheckSpelling(i.Value, IgnoreUppercase:=False) Then
''add code here. ie: if user clicks 'Accept' then
' move word into new column
xlApp.ActiveCell.Select
i.Cut
i.Copy
xlApp.Range("E" & icounter).Select
xlApp.ActiveSheet.Paste
i.Select
i.Delete Shift:=xlUp
icounter = icounter + 1
End if
End If
Next i
Thank you for your help! it is greatly appreciated! The reason why I do not want to create my own spell check dialog is because the unicode text file problems in a manually created dialog box (the files which I am reading in Excel are unicode language files which are not necessarily English).
I am wondering if anyone can direct me to some help regarding the use of the Spell Check Dialog Box. I would like to access Microsoft Excel's spell checking tool, but instead of clicking 'ok' to change words, I want to modify it so that a list of words can be separated into two lists of 'acceptable' and 'unacceptable' words.
I am familiar with the CheckSpelling calls, and am assuming that the code will be somewhat like the following. It will spell check column 'A' words, and if the user accepts the misspelled word, it will be moved to column 'E':
Dim xlApp As Excel.Application 'Excel-object
Set xlApp = New Excel.Application
xlApp.Application.Visible = visibleFiles
Dim aRange As Range ' Column in which to read values from
Dim i As Range ' value of the current cell
Dim icounter As Integer ' keeps track of cell to move incorrect words to
icounter = 1
Set aRange = xlApp.Range("A1", xlApp.ActiveSheet.Cells.SpecialCells(xlLastCell))
For Each i In aRange
' chk for end of range
If i = "" Then
Exit For
End If
' true if word is incorrect
If Not Application.CheckSpelling(i.Value, IgnoreUppercase:=False) Then
''add code here. ie: if user clicks 'Accept' then
' move word into new column
xlApp.ActiveCell.Select
i.Cut
i.Copy
xlApp.Range("E" & icounter).Select
xlApp.ActiveSheet.Paste
i.Select
i.Delete Shift:=xlUp
icounter = icounter + 1
End if
End If
Next i
Thank you for your help! it is greatly appreciated! The reason why I do not want to create my own spell check dialog is because the unicode text file problems in a manually created dialog box (the files which I am reading in Excel are unicode language files which are not necessarily English).