Creating Macro in Outlook 2003

Status
Not open for further replies.

frogman23

Member
Outlook version
Email Account
POP3
I'm sure this question has been asked many times but the more I search, the more confused I get. I have created macros some years ago when I had more brain cells working, but for the life of me I can't get this to work...................

I'm trying to insert a macro in Outlook 2003 to warn me if I inadvertently try to send an email with no subject line.

I found this code:

Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)

Dim strSubject As String

strSubject = Item.Subject

If Len(Trim(strSubject)) = 0 Then

Prompt$ = "Subject is Empty. Are you sure you want to send the Mail?"

If MsgBox(Prompt$, vbYesNo + vbQuestion + vbMsgBoxSetForeground, "Check for Subject") = vbNo Then

Cancel = True

End If

End If

End Sub


and have been trying to insert it in Outlook. I open the VBA editor and can see the code in "ThisOutlookSession" in a window headed VbaProject.OTM - ThisOutlookSession (Code) but, when I click on Tools/Macro/Macros, nothing is visible nor is there any warning when sending mails without subject.

I'm sure I'm doing something immeasurably stupid but would be greatful for being pointed in the right direction.

I'm running Office 2003 on W7 Home Premium x64 with all updates in place.
 
Do you have macro security set on warn for all macro's? Did you restart Outlook? (If i recall correctly, outlook 2003 needs to be restarted for macro security changes to take afect.)
 
Thanks for your reply. I tried different security settings and restarting Outlook, but I think the problem may be due to a combination of a corrupted OTM file (which I've since deleted) and my lack of familiarity with VB. I haven't spent more time on the problem due to other commitments but think I now have some idea of the way forward and will repost when I get the macro to work or need more help.

Thanks again...........
 
As an FYI, I tested the code above and it works fine here. Basic instructions (using your code sample) are here: warn before sending a blank subject




One very common problem with code obtained from the internet is that quotes are converted to curly quotes and it fails in the editor. If lines are red, check the quotes.




Second common problem is allowing macros - Outlook blocks unsigned macros as a security measure and in older versions you need to restart outlook after changing the macro security setting. Some security software will reset the level to high if you use 'no warning' option. Choose warn for all macros instead. After the macro is tested you can sign it using selfcert and reset the dialog to signed macros only.
 
Thanks, I've got the macro working - have tested it, also after stopping and restarting Outlook. What I can't understand is that when I go to "Tools/Macro/Macros", I see no macros - there is no entry in the Macro Name box, nor are there any macros visible below. Am I missing something obvious?
 
Private Sub Application_ItemSend




The macro is private, so it won't be listed in that dialog. It's private because it's triggered on item send - don't need to run it, outlook kicks it off when a message is sent.
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
D Outlook 2016 Creating an outlook Macro to select and approve Outlook VBA and Custom Forms 0
O Macro for creating hyperlinks in Outlook 2007 Using Outlook 3
I Creating an Outlook 2007 macro that attaches a signature to new me Outlook VBA and Custom Forms 1
G Creating Macro to scrape emails from calendar invite body Outlook VBA and Custom Forms 6
N Help creating a VBA macro with conditional formatting to change the font color of all external emails to red Outlook VBA and Custom Forms 5
A Help creating macro for conditional formatting settings Using Outlook 8
S Custom Contact card - need help creating one Outlook VBA and Custom Forms 1
G Event when creating task from mailitem Outlook VBA and Custom Forms 2
T Outlook creating unwanted tasks in Tasks and Todo from emails Using Outlook 1
Fozzie Bear Outlook 2016 Creating a shared local Contacts folder Using Outlook 2
R Creating a user defined function Outlook VBA and Custom Forms 3
M Creating an RSS Feed **FROM** Outlook 2013 Calendar. Using Outlook 5
O How to prevent CC from showing when creating a new mail? Using Outlook 1
N Creating a button or link to a form in the Organizational Forms Library Outlook VBA and Custom Forms 3
B Creating an email with the list of tasks Outlook VBA and Custom Forms 0
L Creating drafts when I thought I was sending Using Outlook 1
R Would creating a new profile cause Outlook to download all the old mails from the server? Using Outlook 1
A Creating Progress Bar or Status Bar Update Outlook VBA and Custom Forms 0
T Outlook creating a folder named: "Unwanted" Using Outlook 3
M Outlook 2007 Contacts Glitch: Creating a new email Using Outlook 1
Liza Creating a rule in outlook to filter messages Using Outlook 0
A Are categories still recommended for creating local distribution lists? Using Outlook 3
S Creating Email - Selecting Pre-Defined Text Using Outlook 2
D Creating an outlook session from Access vba but run silently. With A specific profile Outlook VBA and Custom Forms 1
M Creating Outlook Appointments from Excel Cells Outlook VBA and Custom Forms 1
N Creating New Profile Using Outlook 0
Y Creating custom appointment request form with multiple mail recipients Outlook VBA and Custom Forms 5
M creating email from contact file = 3 emails in To field Using Outlook 3
P Recover / Extract Rules from standalone PST file creating RWZ file Using Outlook 2
A Creating an outlook rule to forward an email with a specific message Using Outlook 1
I Creating meeting invite with disabled tentative button Outlook VBA and Custom Forms 5
E Creating email templates for organizational use Using Outlook 0
N Creating or changing the main new mail message template in Outlook 2010 Using Outlook 2
D Creating custom view with VBA Outlook VBA and Custom Forms 2
J Outlook creating unwanted rule on its own Using Outlook 1
R Creating a Room Mailbox with Exchange Online Outlook VBA and Custom Forms 0
A Creating a rule on “Deleted items” folder Using Outlook 1
CMG73 Creating templates with predefined subject and CC Using Outlook 1
G Creating Contact Sub Folders Using Outlook 2
Rupert Dragwater creating gmail account in Outlook 2013 Using Outlook 7
nathandavies Creating a Select Case for a directory of folders Outlook VBA and Custom Forms 1
2 creating custom stationery Using Outlook 2
Fozzie Bear Creating Custom Meeting Form Outlook VBA and Custom Forms 6
U Creating a (This computer only) folder within an IMAP account directory Using Outlook 1
A Creating archive rule on the clients by script/ Outlook VBA and Custom Forms 3
J Creating a URL from a message body excerpt before forwarding Using Outlook 2
B Need Help Creating Email Based on Subject w Address in Body Outlook VBA and Custom Forms 1
A Creating rule to create week folder and transfer mail using alert Using Outlook 3
J Creating an "isolated" shared calendar in Outlook Outlook VBA and Custom Forms 1
L Creating a Task from Email and Attaching Original Email Outlook VBA and Custom Forms 6

Similar threads

Back
Top