To run spell check, read the Inspector.WordEditor property (returns
Word.Document object).
You can then call Document.CheckSpelling. Below is the function that I use
(Delphi):
//return true if the spelling does not have to be checked or if it was
checked successfully
function TMyAddin.TryCheckSpelling(Inspector: OleVariant): boolean;
var vDocument : OleVariant;
strKeyName : string;
v : integer;
begin
Result:=true; //everything is OK unless we find otherwise
with TRegistry.Create(KEY_READ) do begin
try
RootKey:=HKEY_CURRENT_USER;
strKeyName:=Format('Software\Microsoft\Office\%s.0 \Outlook\Options\Spelling',
[IntToStr(fVersion)]); //DNL
if KeyExists(strKeyName) then begin
if OpenKey(strKeyName, false) then begin
//DNL
if ValueExists('Check') then begin
//DNL
v:=ReadInteger('Check');
if v 0 then begin
//yes, we must check the spelling
vDocument:=Inspector.WordEditor;
if (VarType(vDocument) = VarDispatch) and
(IDispatch(vDocument) nil) then begin
//at least we have the Word.Document object
vDocument.CheckSpelling;
if vDocument.SpellingErrors.Count 0 then begin
//display a prompt if there are errors
if IDNO = MessageBox(GetForegroundWindow,
PChar(rsSpellingErrors), 'SalesLogix', MB_YESNO or MB_ICONWARNING or
MB_DEFBUTTON1) then begin //DNL
//do not send
Result:=false;
end;
end;
end;
end;
end;
end;
end;
finally
Free; //TRegistry
end;
end;
end;
--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
"Dhananjay" wrote in message
...
Thanks Dmitry for your valuable reply, but could you please tell me
what should I do for Spell check, Signature issues. Since I want to
perform my upload and send operation synchronously, I realized that
with the check Recipient.Resolved, I managed issues related to
recipients but still spell check is happening after my upload.
Thanks in advance
On Jan 2, 9:00 pm, "Dmitry Streblechenko" wrote:
Loop through all recipients in the MailItem.Recipients collecito nand
check
if Recipient.Resolved = true.
--
Dmitry Streblechenko (MVP)http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-"Dhananjay" wrote in message
...
Hi,
I have added one button on ribbon viz. "Upload and Send" in ol 2007 /
vb 2005. When user will click on that button, I want to get
information about message like To, CC, body etc and upload that
information to web via web service & send it. But as uploading of mail
information is done before sending, if there are some problems while
sending like - "Could not resolve email address in To,CC" or problems
related to spell check etc, then I can not reverse the process of
uploading of mail.
Is there any way to check beforehand whether mail item is proper to
send or not? So that I could check this part before uploading.
Thanks,
D