Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Spellchecking excel form textbox 2

Status
Not open for further replies.

mileslowe

IS-IT--Management
Aug 9, 2001
16
US
I read the question from thread707-1087775 and cannot get the suggestions to work. Here is the code that I have been trying to use (I have coppied an excel cell value to a form and want to spell check it):

Code:
Private Sub CommandButton2_Click()

'Check HoY Spelling

frmEditValues.tbxCellValue.SetFocus

If (Application.CheckSpelling(frmEditValues.tbxCellValue.Text) = True) Then
    
    MsgBox ("spelling OK")
    
        cmdSpellXtra.BackColor = &HFF00&
      Else
         'NOT OK - Copy text data to hidden XLA 'SpellCheck' worksheet
        Sheets("2007").Select
        Range("F7").Select
        Selection.Copy
        Sheets("SpellCheckSheet").Select
        Range("A1").Select
        ActiveSheet.Paste
        Range("E15").Select
        Worksheets("SpellCheckSheet").CheckSpelling AlwaysSuggest:=True
              cmdSpellXtra.BackColor = &HFF&
                  strSpellCheckXtra = tbxCellValue.Text
                        Application.Worksheets("SpellCheck").Cells(1, 1).Value = strSpellCheckXtra
                        'Now Check spelling
                        Worksheets("SpellCheck").CheckSpelling AlwaysSuggest:=True
                        tbxCellValue.Text = ThisWorkbook.Worksheets("SpellCheck").Cells(1, 1).Text
    End If

End Sub
 
Mike, Thanks so much for all you have done to help. This forum message may help a lot of others who are searching for a sollution to this. I just found a MS Excel help project that uses a better spell checker in Word and seems to work with really long sentences because it uses word. Here is the link to see the article and download the template etc.

 
If possible, I would like to see what you did with the mock up and you can send it to me using my forum name sent to an msn account. If you ever need some testing done for a project send it to me (in appreciation of all you do here!)

 
A nice solution if MS Word is installed. Give it a whirl! I would recommend dispensing with the "auto detection" of the range of cells to check, as described in the article. Simply confine it to the cell you are double-clicking.


Regards,
Mike
 
Mike, that is a good idea as to confining the spell check to only the cell you selected. I am now trying to still get the user form to open to work on text instead of having to mess around with lots of text in a cell. I have forgotten how to get the cell location and sheet name and pass the values from a module to the procedure that is used with the userform opening. I need to do this in order to pass the text in the selected cell to the userform textbox and when done, click an ok button to return the text to the same cell and I am stuck on this part. Anything you can tell me to do this would be helpful. I would still like to see the mock up without using the word program for spell checking if you have time to send it. Hope your day went well.
 
Mike, I just finished up my project and here is the code I used to get the cell value selected to be available globally:

Code:
Public Function CurrentCell() As String
    Application.Volatile
    CurrentCell = ActiveCell.Address
End Function

Here is how I transfer the cell value:

Code:
frmEditValues.tbxCellValue.Text = Range(CurrentCell).Value

Here is how I transfer the text back to the original cell when I am done with the spell editing of cell text in the userform:

Code:
iResponse = MsgBox("Do you want to copy text back to spreadsheet cell location?  ", vbYesNo + vbQuestion + vbApplicationModal + vbDefaultButton1, "")

Select Case iResponse
    Case vbYes:
      ' Enter your code here
      Range(CurrentCell).Value = frmEditValues.tbxCellValue.Text
    Case vbNo:
      ' Enter your code here
End Select

Unload Me

I have the menu bar as written in the word code (link above) and modified it to add another command button to the menu caller userform, which envokes the user form. Puts the selected cell text into the user form and a close command button is used to transfer the text back to the cell and close the user form. I am tired, but again want to thank you for your patience, help and time on this project.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top