Application_ItemSend doesn't trigger after I save the vba project

G

Guest

When I put some code in a new outlook installation it worked. But the moment
I exit Outlook (it prompted to save the project) the Application_ItemSend
doesn't trigger anymore. The code is still there (Alt-F11). I have to
delete the vbaproject.otm, paste in the code (without saving it) in order for
it to work. But as soon as I exit Outlook (save the project or not), it
doesn't work again. Any idea? Thanks.
 
S

Sue Mosher [MVP-Outlook]

You mean, as soon as you exit and restart Outlook, right? If so, then maybe Outlook isn't shutting down completely before you restart.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
G

Guest

Hi, Sue,

No, I restarted the computer. Even power-down. I tried 3 computers here
and they have the exact behaviors. After I reboot and restart Outlook, I
"ALT-F11" and the code is there under "Project1 -> Microsoft Office Outlook
Objects -> ThisOutlookSession". I tried Outlook 2003 and the new Outlook
2007 beta and they all show the same behavior. The code was really simple:

Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
MsgBox "You forgot the Subject line."
Cancel = True
End Sub

Thanks.
 
S

Sue Mosher [MVP-Outlook]

What is your macro security setting?

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
G

Guest

I took back. I set it to medium, and it works now.
But the pop up window always shows in the back, not in the front. I tested
it in outlook 2007, which pops up in the front, but in outlook 2003 SP2, it
pops in the back. Any idea?
 
G

Guest

I have tried following, but the pop up window still shows in the back, not in
the front of new message window.
strMsg = "You forgot the Subject line. Do you want to continue?"
intRes = MsgBox(strMsg, vbYesNoCancel + vbDefaultButton1 +
vbSystemModel, "Keep Copy?")
Select Case intRes
Case vbNo
Item.DeleteAfterSubmit = True
Case vbCancel
Cancel = True
Case vbYes
' default behavior -- nothing to change
End Select

Cancel = True
 
S

Sue Mosher [MVP-Outlook]

Try correcting vbSystemModel to vbSystemModal.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 

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