Outlook spell check

  • Thread starter Thread starter Jim Schacht
  • Start date Start date
J

Jim Schacht

Greetings All,

Thanks for reading my post.
Can you tell me how to invoke whatever spell-check Outlook uses by default?
I'm amazed at the lack of hits I'm finding on this in newsgroups. I have
the following code in a macro:

With itmCurrent
.SentOnBehalfOfName = "someone else"
.DeleteAfterSubmit = True
strSubject = .Subject
Set itmNew = .Copy
.Send
End With

It does not use spell-check although spell-check is enabled on the client
and is used when the "send" button is clicked. I currently have a
work-around of calling Word's spell-check but it is very cumbersome and I
don't like it. I actually open a temporary Word doc, copy the body of the
message to the temp doc, run Word's spell-check, copy the corrected text
back to the Outlook message and then send. Not only is this slower than if
I were to just click the send button it just looks messy.

Please help if you can. I own 3 Outlook programming books and haven't found
in them or numerous newsgroups, what I assume, will be an easy solution.

Best regards,
Jim
 
You can use CommandBars to execute any toolbar or menu command, in this case
the Tools | Spelling menu command if Word is not the editor. If Word is the
Editor, then you would use Word methods.
 
Hi Sue,

Thanks for the quick answer. I'm developing in Outlook 2002, SP1. Word is
not my default editor. I do not see an option for tools>spelling. I don't
see spelling listed anywhere except as a tab in the "Options..." dialog.

One of my books, which you wrote the forward, "Building Applications with
Outlook 2000", has some excellent references to the commandbar controls.
I'm having a little difficulty figuring out exactly where to start, would
you point me a little closer?

Best regards,
Jim
 
Jim-

When you are writing a new e-mail, on that form you should
have a little spellcheck icon that looks like the letters
ABC and a check mark. Until you write some text into the
body of the e-mail, it will be disabled (grayed out).

If not, go to the VIEW menu, and make sure, under
TOOLBARS, that the STANDARD toolbar is selected.

-Andrew Cushen
=============================================
 
Open a message. Click in the message body. Now look on the Tools menu. The
first command should be Spell.

In your book, see pp. 340-1, for sample code to get a toolbar button. You
would, of course, need to use the Inspector, not the Explorer, to get a
button from an open message's toolbars.

Another example can be found at
http://www.outlookcode.com/threads.aspx?forumid=1&messageid=2958, showing
how to use the Execute method once you have the button. To use the
FindControl method shown in that sample, you need the ID for the toolbar
button or menu command. If you don't want to write your own code to recurse
the Explorer.CommandBars and Inspector.CommandBars collections, you can use
either the CommandBars Browser or Outlook Spy tools listed at
http://www.slipstick.com/dev/vb.htm#tools

--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
Thanks Andrew. Even though my standard toolbar was selected, I must have
made some customization because it didn't even show as an option until I
reset the toolbar.

Jim
 
Thanks Sue! This should do the trick for me. Once again I appreciate your
help.

Best regards,
Jim
 
Hi,

I actually got it to work using this code. Is there any problems with the
way I'm doing it? The "findcontrol" method is warped - I can't get my mind
around it. ;-)

Dim ctlSpellCheck As CommandBarControl
Dim cbrMenuBar As CommandBar

Set cbrMenuBar = Application.ActiveInspector.CommandBars("Standard")

Dim ctlTmp As CommandBarControl
For Each ctlTmp In cbrMenuBar.Controls
If ctlTmp.Type = msoControlButton Then
If ctlTmp.Caption = "&Spelling..." Then
Set ctlSpellCheck = ctlTmp
End If
End If
Next
ctlSpellCheck.Execute

I thought it might be more universal if I used "ID" instead of caption but I
have no idea if that is fixed for all users or if it is dependent on their
particular configuration. The caption will be safe in my environment -
there should be no derivations of this.

Thanks for your help!

Jim
 
Caption is both language dependent and user-customizable. That's why FindID
is better.
--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
If I find the ID for the control I want to access, will this be the same ID
for all clients, or is this dependent on something else? What I mean is
could I change the code below from:
If ctlTmp.Caption = "&Spelling..." Then...
to:
If ctlTmp.ID = 2 Then...

Where does ID come from? Is it an index or what?

Thanks,
Jim
 
Yes, that's one reason IDs are good. The other is that you don't need to use
all those If statements. You just use FindControl with the ID as the
argument.

It's not an index. See my earlier message for tools.

--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
Sue,

Now the findcontrol method makes sense!

I had the Outlookspy installed but it kept crashing my Outlook so I
uninstalled it. I can always iterate through the controls to find the ID
now that I know it is a static number.

Best regards,
Jim
 
Back
Top