PC Review


Reply
Thread Tools Rate Thread

Run the Spell Check through code

 
 
LisaB
Guest
Posts: n/a
 
      29th Jan 2004
Does anyone know the code like the DoCmd or DoMenuItem to run the spell
checker?

I have a client who wants me to put a command button on the user input form
to run the spell checker that will check the Memo Field


 
Reply With Quote
 
 
 
 
Dirk Goldgar
Guest
Posts: n/a
 
      29th Jan 2004
"LisaB" <lbagley(ReTHis)@mayatech.com> wrote in message
news:%(E-Mail Removed)
> Does anyone know the code like the DoCmd or DoMenuItem to run the
> spell checker?
>
> I have a client who wants me to put a command button on the user
> input form to run the spell checker that will check the Memo Field


The command is

RunCommand acCmdSpelling

but you'll first want to set the focus to the control you want to
spell-check; e.g.,

Me!txtMyMemoField.SetFocus
RunCommand acCmdSpelling

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)


 
Reply With Quote
 
Bruce M. Thompson
Guest
Posts: n/a
 
      29th Jan 2004
> Does anyone know the code like the DoCmd or DoMenuItem to run the spell
> checker?
>
> I have a client who wants me to put a command button on the user input form
> to run the spell checker that will check the Memo Field


The following will activate the spellchecker (if installed - will not work with
RunTime installations):

DoCmd.RunCommand acCmdSpelling

This will check the spelling of all the fields on the form, not just the Memo
field, and will move forward through the form's recordset from the current
record until the last record has been checked (this is of no consequence if the
form is filtered to one record only). I don't think you can limit it to one
field.

--
Bruce M. Thompson, Microsoft Access MVP
(E-Mail Removed) (See the Access FAQ at http://www.mvps.org/access)
>> NO Email Please. Keep all communications

within the newsgroups so that all might benefit.<<


 
Reply With Quote
 
Dirk Goldgar
Guest
Posts: n/a
 
      29th Jan 2004
"Dirk Goldgar" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)
> "LisaB" <lbagley(ReTHis)@mayatech.com> wrote in message
> news:%(E-Mail Removed)
>> Does anyone know the code like the DoCmd or DoMenuItem to run the
>> spell checker?
>>
>> I have a client who wants me to put a command button on the user
>> input form to run the spell checker that will check the Memo Field

>
> The command is
>
> RunCommand acCmdSpelling
>
> but you'll first want to set the focus to the control you want to
> spell-check; e.g.,
>
> Me!txtMyMemoField.SetFocus
> RunCommand acCmdSpelling


Hmm, it occurs to me after reading Bruce's response that you may have to
select the text in the memo field to restrict the check to that text:

With Me!txtMyMemoField
.SetFocus
.SelStart = 0
.SelLength = Len(.Text)
End With
RunCommand acCmdSpelling

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)


 
Reply With Quote
 
LisaB
Guest
Posts: n/a
 
      29th Jan 2004
Thank You,

What if I would like to check more than the one memo field on the form, for
example if the form has 3 text fields and 2 memo fields to be spell checked,
how do I limit the spell checker code to only the current record?

one of the forms I am using this function on, pulls more than one
record from the database. This function goes through all the records even
if I highlight the text I want checked.

"Dirk Goldgar" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> "Dirk Goldgar" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)
> > "LisaB" <lbagley(ReTHis)@mayatech.com> wrote in message
> > news:%(E-Mail Removed)
> >> Does anyone know the code like the DoCmd or DoMenuItem to run the
> >> spell checker?
> >>
> >> I have a client who wants me to put a command button on the user
> >> input form to run the spell checker that will check the Memo Field

> >
> > The command is
> >
> > RunCommand acCmdSpelling
> >
> > but you'll first want to set the focus to the control you want to
> > spell-check; e.g.,
> >
> > Me!txtMyMemoField.SetFocus
> > RunCommand acCmdSpelling

>
> Hmm, it occurs to me after reading Bruce's response that you may have to
> select the text in the memo field to restrict the check to that text:
>
> With Me!txtMyMemoField
> .SetFocus
> .SelStart = 0
> .SelLength = Len(.Text)
> End With
> RunCommand acCmdSpelling
>
> --
> Dirk Goldgar, MS Access MVP
> www.datagnostics.com
>
> (please reply to the newsgroup)
>
>



 
Reply With Quote
 
Dirk Goldgar
Guest
Posts: n/a
 
      29th Jan 2004
"LisaB" <lbagley(ReTHis)@mayatech.com> wrote in message
news:(E-Mail Removed)
> Thank You,
>
> What if I would like to check more than the one memo field on the
> form, for example if the form has 3 text fields and 2 memo fields to
> be spell checked, how do I limit the spell checker code to only the
> current record?
>
> one of the forms I am using this function on, pulls more than
> one record from the database. This function goes through all the
> records even if I highlight the text I want checked.


The code I posted *shouldn't* check more than the field it selects -- it
doesn't for me, at least. You did use the amended version, yes? If
it's going through all the fields, something I hadn't anticipated is
going on, because it works in my quick test.

To check all fields on the current record, this seems to work:

RunCommand acCmdSelectRecord
RunCommand acCmdSpelling

If you want to check multiple fields but not all of them, I think you're
going to have to do them one at a time: programmatically select a
field, RunCommand acCmdSpelling, programmatically select another field,
RunCommand acCmdSpelling ... and so on.

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)


 
Reply With Quote
 
John Spencer (MVP)
Guest
Posts: n/a
 
      30th Jan 2004
Here is a bit of sample code. It can be generalized, but this should give you
the idea. I think I've got all the necessary steps in this sample code. It's
been awhile since I've done this and I am on a computer without my sample code.

Private Sub Command30_Click()

With Me.txtOtherRace
.SetFocus
If Len(.Text & vbNullString) > 0 Then
'Must check the length, because if it is zero then the spellcheck
'and you initiate spellchecking, the spellcheck will check the entire form
'and the entire recordset
.SelStart = 0
.SelLength = Len(.Text)
DoCmd.RunCommand acCmdSpelling
End If
End With

With Me.txtOtherHealthIssue
.SetFocus
If Len(.Text & vbNullString) > 0 Then
.SelStart = 0
.SelLength = Len(.Text)
DoCmd.RunCommand acCmdSpelling
End If
End With

End Sub


LisaB wrote:
>
> Thank You,
>
> What if I would like to check more than the one memo field on the form, for
> example if the form has 3 text fields and 2 memo fields to be spell checked,
> how do I limit the spell checker code to only the current record?
>
> one of the forms I am using this function on, pulls more than one
> record from the database. This function goes through all the records even
> if I highlight the text I want checked.
>
> "Dirk Goldgar" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > "Dirk Goldgar" <(E-Mail Removed)> wrote in message
> > news:(E-Mail Removed)
> > > "LisaB" <lbagley(ReTHis)@mayatech.com> wrote in message
> > > news:%(E-Mail Removed)
> > >> Does anyone know the code like the DoCmd or DoMenuItem to run the
> > >> spell checker?
> > >>
> > >> I have a client who wants me to put a command button on the user
> > >> input form to run the spell checker that will check the Memo Field
> > >
> > > The command is
> > >
> > > RunCommand acCmdSpelling
> > >
> > > but you'll first want to set the focus to the control you want to
> > > spell-check; e.g.,
> > >
> > > Me!txtMyMemoField.SetFocus
> > > RunCommand acCmdSpelling

> >
> > Hmm, it occurs to me after reading Bruce's response that you may have to
> > select the text in the memo field to restrict the check to that text:
> >
> > With Me!txtMyMemoField
> > .SetFocus
> > .SelStart = 0
> > .SelLength = Len(.Text)
> > End With
> > RunCommand acCmdSpelling
> >
> > --
> > Dirk Goldgar, MS Access MVP
> > www.datagnostics.com
> >
> > (please reply to the newsgroup)
> >
> >

 
Reply With Quote
 
Bruce M. Thompson
Guest
Posts: n/a
 
      30th Jan 2004
Thanks Dirk and John for refreshing my memory on this. I just couldn't recall
how to limit the spellcheck to one field/record. <sheesh>

--
Bruce M. Thompson, Microsoft Access MVP
(E-Mail Removed) (See the Access FAQ at http://www.mvps.org/access)
>> NO Email Please. Keep all communications

within the newsgroups so that all might benefit.<<


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Spell Check states no longer offered for this language. Does anyone know how I can get spell check? Bruce Hagen Windows Vista Mail 0 21st Jul 2010 04:38 AM
Outlook 2007 spell check and .NET code rob_tt08 Microsoft Outlook Program Addins 3 14th Nov 2008 03:10 PM
Spell Check Memo Code NOT Working, Need Help Dave Elliott Microsoft Access Forms 4 13th Aug 2004 06:03 AM
Spell Check ONLY (1) Field. What is wrong with this code??? Dave Microsoft Access Forms 3 12th Aug 2004 04:19 AM
Disable spell check, or detect + run code prior to it. Bill Microsoft Access VBA Modules 0 8th Jan 2004 08:13 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:06 PM.