Macro in Outlook 2007 not working in Windows 7

Hi everyone, I have been using a macro in outlook 2007 for a month or two now. It works on all our xp machines but not in our windows 7 machines. This does not make much sense to me. The macro is used so when someone sends an email without a subject it will prompt them their subject line is empty.

Here is the code


Any idea why its not working? I noticed it works 1 time but after that it stops working


Thx in advance

Matt

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

Open in new window

meshoxfordAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

David LeeCommented:
Hi, Matt.

Are macros enabled in Outlook on this computer?
0
meshoxfordAuthor Commented:
yes they are
0
David LeeCommented:
The operating system has NOTHING to do with Outlook macros and how they work.  Unless of course the macro in question is making an API call, which this macro is not.  Can you run any macros manually?  For example,

Sub Testing()
    MsgBox "The macro ran"
End Sub
0
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

meshoxfordAuthor Commented:
Okay , I just tested it on another computer. I go into visual basic editor. I go into thisoutlooksession and I add that code. When I save it works. WHen I restart outlook it doesnt work. When I go to enable macros, I go to macro security correct? Or is there something else I need to do?

Matt
0
David LeeCommented:
After restarting Outlook open the VB editor and go to the code.  Place the cursor in the code (it doesn't matter where).  Now press F8.  What happens?
0
meshoxfordAuthor Commented:
It just dings, nothing else
0
David LeeCommented:
Strange.  Ok, let's try this.  Remove that code and replace it with the code below.  Close and restart Outlook.  What happens?
Private Sub Application_Startup()
    MsgBox "Macros are enabled"
End Sub

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
meshoxfordAuthor Commented:
aha I got it! thanks so much, I just created a new macro on top of this one and it worked. That was so strange... Thanks so much for the help guys, I put your code in and then I created a new macroo with my old code and it worked

thanks bluedevil
0
meshoxfordAuthor Commented:
Thanks so much!
0
David LeeCommented:
You're welcome.  Glad I could help.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Outlook

From novice to tech pro — start learning today.