Message from a Button on Outlook Today

M

Mark Milliman

I have customized Outlook Today to my liking. Everything worked great under
Outlook 2003, but not with Outlook 2007. I tested all of my other macros
created under previous versions of Outlook and they work fine even the ones
that use CDO and Redemption. My simpliest scripts do not work and I cannot
figure out why.

I have created a new web page in OUTLWVW.DLL that formats my appointements,
tasks, links, and other things the way I want. There are two simple buttons
on this page that call a VBScript that are suppose to open a message window
from either one of my e-mail accounts. I had a convoluted way of doing this
in previous versions of Outlook, but Outlook 2007 now adds SendUsingAccount.
The problem is that I can no longer create a new message item. I have tried
several ways but none of them work. Here are the three methods I have
already attempted:

Method 1:
<script for="btnSndComcast" event="onClick" language="VBScript">
Set objMsg = ThisOutlookSession.CreateItem(olMailItem)

objMsg.SendUsingAccount = ThisOutlookSession.Session.Accounts(1)

objMsg.Display


</script>

Method 2:

<script for="btnSndInphotonics" event="onClick" language="VBScript">

Set objMsg = Application.CreateItem(olMailItem)


objMsg.SendUsingAccount = Application.Session.Accounts(2)

objMsg.Display


</script>

Method 3:

Set oApp = CreateObject("Outlook.Application")Set objMsg =
oApp.CreateItem(olMailItem)objMsg.SendUsingAccount =
oApp.Session.Accounts(2)objMsg.Display Methods 1 and 2 produce the same
results: Object required: 'ThisOutlookSession' Method 3 says that ActiveX
cannot create object. I cannot figure out what is going on here. It use to
work under Outlook 2003 with Method 3. I verified it on another machine
that has not been upgraded to Outlook 2007. Did something change in the
object model in Outlook 2007 that requires me to do more? Please
help.Thanks,Mark Milliman
 
M

Mark Milliman

Sorry, formatting problems.

Mark Milliman said:
I have customized Outlook Today to my liking. Everything worked great
under Outlook 2003, but not with Outlook 2007. I tested all of my other
macros created under previous versions of Outlook and they work fine even
the ones that use CDO and Redemption. My simpliest scripts do not work and
I cannot figure out why.

I have created a new web page in OUTLWVW.DLL that formats my
appointements, tasks, links, and other things the way I want. There are
two simple buttons on this page that call a VBScript that are suppose to
open a message window from either one of my e-mail accounts. I had a
convoluted way of doing this in previous versions of Outlook, but Outlook
2007 now adds SendUsingAccount. The problem is that I can no longer create
a new message item. I have tried several ways but none of them work.
Here are the three methods I have already attempted:

Method 1:
<script for="btnSndComcast" event="onClick" language="VBScript">
Set objMsg = ThisOutlookSession.CreateItem(olMailItem)

objMsg.SendUsingAccount = ThisOutlookSession.Session.Accounts(1)

objMsg.Display


</script>

Method 2:

<script for="btnSndInphotonics" event="onClick" language="VBScript">

Set objMsg = Application.CreateItem(olMailItem)


objMsg.SendUsingAccount = Application.Session.Accounts(2)

objMsg.Display


</script>

Method 3:

Set oApp = CreateObject("Outlook.Application")
Set objMsg = oApp.CreateItem(olMailItem)
objMsg.SendUsingAccount = oApp.Session.Accounts(2)
objMsg.Display

Methods 1 and 2 produce the same results: Object required:
'ThisOutlookSession' Method 3 says that ActiveX
cannot create object. I cannot figure out what is going on here. It use
to work under Outlook 2003 with Method 3. I verified it on another
machine that has not been upgraded to Outlook 2007. Did something change
in the object model in Outlook 2007 that requires me to do more? Please
help.

Thanks,
Mark Milliman
 
K

Ken Slovak - [MVP - Outlook]

Setting SendUsingAccount is not valid until the Item.Send or
Application.ItemSend events.
 
M

Mark Milliman

Ken:

Thanks for pointing out my problem, but my original issue exists without
using the SendUsingAccount. The first line of my script fails. If I could
fix that problem then I would be off to addressing the proper use of
SendUsingAccount.

Any idea why I cannot even create a mailItem?

Mark
 
K

Ken Slovak - [MVP - Outlook]

This is just a guess, but I'm betting you're being restricted by what sort
of code can run in Outlook Today. Most things related to folder Web pages
are being deprecated and HTML scripting is being severely limited due to
security concerns. I think that's what's happening and if so there's no fix
for that within the confines of the Outlook Today page.
 
M

Mark Milliman

Ken:

Do you know where I could look on MSDN to see if that is the case. I am not
sure if that is true because the Outlook Today pages have JScript functions
in them that access folders, todo lists, and appointments. Maybe some
things are allowed but others like creating new e-mail messages are not for
security reasons. I would think that I would be allowed to create a
mailItem just not save or send it. If you could point me in the right
direction to see what changed in OLK2007 I would be greatful.

Thanks,
Mark Milliman
 
K

Ken Slovak - [MVP - Outlook]

I have no idea where any information on that would be located. As I said, it
was a guess. If it was me I'd do a lot of searching using Google and see if
any information turned up.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top