• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 309
  • Last Modified:

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

0
meshoxford
Asked:
meshoxford
  • 5
  • 5
1 Solution
 
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
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
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
 
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 5
  • 5
Tackle projects and never again get stuck behind a technical roadblock.
Join Now