View Single Post
  #13   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Lee Ann[_2_] Lee Ann[_2_] is offline
external usenet poster
 
Posts: 16
Default Spell Check in Text Boxes

I'm getting a Compile Error: Syntax error. When it brings up the macro
after getting the error, there are changes in what was originally put in -
the first line is highlighted in yellow:

Public Sub SpellCheckActiveXTextBoxes()


It has then put " after the first MsgBox "Spelling for this ActiveX control
has been" and has made the word 'checked' red.

Where the second MsgBox string is, it has again put " after have and shows
the 'been checked' in red.

I've pasted a copy below:

MsgBox "Spelling for this ActiveX control has been"
checked."
End If
On Error GoTo 0
Next

MsgBox "Done - spelling for all ActiveX controls on this sheet have"
been checked!"





"jamescox" wrote:


The fact that these are ActiveX textboxes makes a lot of difference.

On some worksheet in your workbook, define a two-cell named range as
ActiveXText (it can be on the sheet where your ActiveX textboxes are,
but it doesn't have to be there). Note that the 'two cell range'
comment is important - it can be two cells, one above the other or
side-by-side, but it needs to be two cells.


Add this macro

Public Sub SpellCheckActiveXTextBoxes()

Dim aOleTxtBox As OLEObject
Dim rText As Range

Set rText = Range("ActiveXText")

For Each aOleTxtBox In ActiveSheet.OLEObjects

On Error Resume Next
rText.Cells(1).Value = aOleTxtBox.Object.Text
If Err = 0 Then
Application.Goto Reference:=aOleTxtBox.TopLeftCell
rText.Cells.CheckSpelling
aOleTxtBox.Object.Text = rText.Cells(1).Text
MsgBox "Spelling for this ActiveX control has been
checked."
End If
On Error GoTo 0
Next

MsgBox "Done - spelling for all ActiveX controls on this sheet have
been checked!"

End Sub

then go to a sheet that has ActiveX text boxes and run it. It should
move you from ActiveX textbox to ActiveX text box and pop open the Spell
Check form at any ActiveX Textbox that it finds a mispelled word in. If
you don't care for the MsgBox popups, you can comment those out of the
macro.

This hasn't been tested really well with other ActiveX controls other
than the TextBox and the Label. It will display the Spell Check form
for any ActiveX control that has a Text property.

Hope this version works for you (finally!)...


--
jamescox
------------------------------------------------------------------------
jamescox's Profile: http://www.thecodecage.com/forumz/member.php?userid=449
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=120599