Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

objSendButton.Execute?

0 views
Skip to first unread message

Brian McCullough

unread,
Jan 30, 2007, 10:44:29 AM1/30/07
to
Hello,

In a VB6 COM Add In for Outlook (XP), can you automate the pressing of the
Send button on a MailItem's Inspector? I am trying, but keep getting the
following error message:

-2147467259: Method '~' of object '~' failed

for example:

Dim objSendBtn As CommandBarControl
Set objSendBtn = m_objInsp.CommandBars.FindControl(ID:=2)

'do some simple processing here, such as change the subject line

objSendBtn.Execute

Ken Slovak - [MVP - Outlook]

unread,
Jan 30, 2007, 10:49:04 AM1/30/07
to
Are you getting the correct button? Why not just use item.Send?

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"Brian McCullough" <nospam...@nospam.com> wrote in message
news:OdboIWIR...@TK2MSFTNGP02.phx.gbl...

Brian McCullough

unread,
Jan 30, 2007, 10:54:23 AM1/30/07
to
I am getting the correct button. I display a message box displaying the ID
and caption of the button for debugging purposes.

Item.Send does not take into account the Spell check settings...I am trying
to see if I can just mimic the Send Button functionality which does perform
Spell Check if the "Always check spelling before sending" option is selected
(Tools > Options > Spelling tab).

Is the Send button's Execute method blocked by the security updates?

-Brian

"Ken Slovak - [MVP - Outlook]" <kens...@mvps.org> wrote in message
news:uzXWaYIR...@TK2MSFTNGP04.phx.gbl...

Brian McCullough

unread,
Jan 30, 2007, 12:35:58 PM1/30/07
to
Hello,

OK, looks like automating the Send button in Outlook XP does not work
because the the Security Updates: http://support.microsoft.com/kb/262701

I posted about this previously
(microsoft.public.office.developer.com.add_ins: "Automate Spell Check With
Outlook XP?"), but not sure I had a complete understanding of the
requirements before. Here we go...

In general, Word is NOT being used as the email editor, but some users may
be using it as their editor. I am looking for a way to do the following:

1. If the user has the "Always check spelling before sending" option
selected in Outlook:
A. Perform Spell check (using which ever spell check is appropriate for
the client - Word or Outlook)
2. If spell check didn't run (because the "Always check spelling before
sending" is not selected)
OR the spell check did run and it was not cancelled and it completed:
A. Change the Subject line
B. Send the message

This sounds like such a simple thing, but I am not seeing a way to
accomplish this.

Is it possible to determine the "Always check spelling before sending"
value?

It seems that Outlook's Spell Checking is not available to be automated,
(short of calling the Execute method on the "Spelling" command). That being
said, are there any drawbacks to instantiating a Word Application/Document
and passing letting it handle the Spell Checking? Is this spell check call
to Word synchronous?

Thanks again!!!

"Brian McCullough" <nospam...@nospam.com> wrote in message

news:uSg0qbIR...@TK2MSFTNGP04.phx.gbl...

Ken Slovak - [MVP - Outlook]

unread,
Jan 30, 2007, 2:56:26 PM1/30/07
to
Word.Document.CheckSpelling() is a sub, so it's not going to wait for spell
check completion as far as I know. I'm not sure it even can be determined
that the spell check is finished. according to the Word help if a spelling
error is detected the Spelling and Grammar dialog is displayed. So your code
would continue after calling spell check and wouldn't know it was finished
or canceled or whatever.

You might just have to use a 3rd party spelling control of some kind if you
want additional control over the process.

Look at HKCU\Software\Microsoft\Office\11.0\Outlook\Options\Spelling\Check
(change 11.0 to your version, 2002 would be 10.0). If Check (REG_DWORD) = 0
no spell check, if = 1 then spell check.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"Brian McCullough" <nospam...@nospam.com> wrote in message

news:uKBWgUJ...@TK2MSFTNGP06.phx.gbl...

Brian McCullough

unread,
Jan 30, 2007, 3:38:41 PM1/30/07
to
Are there any other drawbacks to using the Word spellcheck?

For example, do they use different dictionaries? Are there any other
gotchas?

Thanks again, Ken!!

"Ken Slovak - [MVP - Outlook]" <kens...@mvps.org> wrote in message

news:OsZillK...@TK2MSFTNGP06.phx.gbl...

Brian McCullough

unread,
Jan 30, 2007, 3:45:36 PM1/30/07
to
Can you recommend any third party spell checking tools for use with Outlook?


"Brian McCullough" <nospam...@nospam.com> wrote in message

news:uQNIi6KR...@TK2MSFTNGP05.phx.gbl...

Ken Slovak - [MVP - Outlook]

unread,
Jan 30, 2007, 3:59:57 PM1/30/07
to
If the Outlook editor is being used the Word spell checker won't use the
same dictionaries of course. You can specify custom dictionaries to use with
Word spell check, but to tell the truth I haven't done anything that
required any spell checking so I'm not all that familiar with all the
possible scenarios.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"Brian McCullough" <nospam...@nospam.com> wrote in message

news:uQNIi6KR...@TK2MSFTNGP05.phx.gbl...

Ken Slovak - [MVP - Outlook]

unread,
Jan 30, 2007, 4:00:26 PM1/30/07
to
No idea. I've never used one but I know they're out there.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"Brian McCullough" <nospam...@nospam.com> wrote in message

news:ejg2Z%23KRHH...@TK2MSFTNGP06.phx.gbl...

0 new messages