Preventing blank subject lines

Status
Not open for further replies.
S

SLorenB

Is there a rule or script that I could implement that would warn me that I'm attempting to send an email with a blank subject?
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
S

SLorenB



Thanks for the prompt response. I dont have any problem using VBA except I must not understand how to implement the code because I can't get it to work! Sounded simple from the link but I can still send blank subjects.

The link said to put the code into the module ThisOutlookSession, below is the contents of my ThisOutlookSession module:

Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
Dim m As Variant
Dim strBody As String
Dim intIn As Long
Dim intAttachCount As Integer, intStandardAttachCount As Integer<
On Error GoTo handleError
'Edit the following line if you have a signature on your email that includes images or other files. Make intStandardAttachCount equal the number of files in your signature.
intStandardAttachCount = 0
strBody = LCase(Item.Body)
intIn = InStr(1, strBody, "original message")
If intIn = 0 Then intIn = Len(strBody)
intIn = InStr(1, Left(strBody, intIn), "attach")
intAttachCount = Item.Attachments.Count
If intIn > 0 And intAttachCount <= intStandardAttachCount Then
m = MsgBox("It appears that you mean to send an attachment," & vbCrLf & "but there is no attachment to this message." & vbCrLf & vbCrLf & "Do you still want to send?", vbQuestion + vbYesNo + vbMsgBoxSetForeground)
If m = vbNo Then Cancel = True
End If
handleError:
If Err.Number <> 0 Then
MsgBox "Outlook Attachment Reminder Error: " & Err.Description, vbExclamation, "Outlook Attachment Reminder Error"
End If
End Sub

Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
If Trim(Item.Subject) = " " Then
Cancel = True
MsgBox "Please enter a subject!", vbInformation
End If
End Sub

Any idea where I can look to see what I did wrong?

Thanks!
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange


if you are already using the attachment checker, you just need to add the subject line one to the code. I think you just need to do this:

If intIn > 0 And intAttachCount <= intStandardAttachCount Then
m = MsgBox("It appears that you mean to send an attachment," & vbCrLf & "but there is no attachment to this message." & vbCrLf & vbCrLf & "Do you still want to send?", vbQuestion + vbYesNo + vbMsgBoxSetForeground)
If m = vbNo Then Cancel = True
End If
If Trim(Item.Subject) = " " Then
Cancel = True
MsgBox "Please enter a subject!", vbInformation
End If

handleError:
If Err.Number <> 0 Then
MsgBox "Outlook Attachment Reminder Error: " & Err.Description, vbExclamation, "Outlook Attachment Reminder Error"
End If
End Sub

The code will check for attachment, then subject. if you want to check the subject first, put it at the top, after
On Error GoTo handleError
 
S

SLorenB



A new discovery! It turns out that this code does not "work". What was doing the attachment checking was a PowerTool not this VBA code. Once I uninstalled the PowerTool I was able to send an email without an attachment as well which tells me this code is not be executed, at least properly. I think this is over my head and I'll just have to me humanly alert to the subject line!

Thanks!
 
S

sam nelson



As Diane says, you can "fix" this by using a macro. However, to make it work every time you start Outlook, you have to either:

Option 1) Sign the macro and have Outlook trust it, by creating a self-signed certificate and sign the macro using the stepshere , then tell Outlook to trust that certificate the next time it starts (aka "the lesser of two evils").

Option 2) Turn off macro security so anything from anybody can run without you knowing it (aka "this is so awful I shouldn't even be enumerating it as an option, but at least I'm not telling them how to turn off macro security").

Really, it's just silly that Outlook doesn't have a basic option for this, especially since Outlook Express has/had it for many many years. Wake up and put this in the next version of Outlook, Microsoft!
 
Status
Not open for further replies.
Thread starter Similar threads Forum Replies Date
G Bcc help - Preventing multiple forwards from a bcc'd distribution group Using Outlook 1
H Preventing the Send button from being clicked on an Outlook Form Outlook VBA and Custom Forms 1
D Preventing users to disable an Outlook Add-in Using Outlook.com accounts in Outlook 5
M Preventing conversation from moving to the top of the message box? Using Outlook 7
T hacked account preventing outgoing emails from unathorized users Using Outlook 5
O Busniess contact manager preventing access to Outlook emails after Blackberry Desktop Manager update Using Outlook 1
J ____Incorrect Live ID preventing Outlook from Opening Using Outlook 3
B outlook is preventing out going comcast email for potentially problem attachment__ Using Outlook 2
David Michaels Contact card shows blank Outlook 2013 Outlook VBA and Custom Forms 0
J Installed Outlook but Default Calendar is Blank Using Outlook 3
A Outlook Postal Addresses Missing/Blank Using Outlook 0
J Blank GAL in OAB Exchange Server Administration 1
M Blank Pop-up Window when click "Manage Sharing" BCM (Business Contact Manager) 1
R How to search for blank userproperties field Outlook VBA and Custom Forms 4
Copwriter Paragraph formatting in blank messages/stationery Using Outlook 3
J Meeting Invites Go Blank When Forwarding or Accepting Using Outlook 2
J Calendar Views (2013) are Blank Using Outlook 1
T From Field Blank when saving to folder other than Sent items Using Outlook 2
K blank emails generated in outbox when clicking on Inbox and other foders Using Outlook 0
A VBA Script to Forward Spam to AntiSpam Provider Using "Blank" Form Outlook VBA and Custom Forms 2
F Change default value of date/time type from "None" to Blank Using Outlook 1
G Outlook Forms Blank once sent. Using Outlook 1
M Receipients are receiving a blank email when I send a form Using Outlook 1
K Custom Forms - Blank Message Received! Using Outlook 1
M outlook items attached show up blank Using Outlook 3
E Blank Print Preview when access via the Quick Access toolbar Using Outlook 3
S Blank body when replying with an Outlook Form. Using Outlook 21
M Outlook 2003 rule to detect a blank category Using Outlook 1
M Emails Appear Blank in Outlook 2007 Using Outlook 1
D Outlook 2003, Export to CSV, "Export From' blank Using Outlook 5
C Bug? Forwarded message body is blank Using Outlook 2
L How to remove blank lines, globally, from outgoing e-mail Using Outlook 2
K Exchange 2010 Health explorer on configuration, performace & security state is blank Exchange Server Administration 2
C Outlook 2010 sending out blank emails in reply to incoming mail- of it's own accord. Using Outlook 1
B Blank email list views on Outlook 2010 / 2007 with Exchange 2010 SP1 (on Citrix and Desktops) Using Outlook 7
K Contacts are blank from new message Using Outlook 2
K Reminder window is now blank after data file move Using Outlook 6
E Problem with In bound e-mails. Subject and From lines are blank and messages are either blank or in text that is hard to read. Using Outlook 1
P Blank page opening document through Direct Access in OWA from Exchange 2007 SP3 Using Outlook 3
H Exchange 2010 - Blank e-mail body in Outlook but typically viewable in OWA Exchange Server Administration 6
M Calendar: Subject goes blank when I resize an appointment Using Outlook 3
A Microsoft Outlook Calendar goes blank and locks up? Using Outlook 2
S Hit the Reply button and the Send To field is blank Using Outlook 2
A blank attachment in microsoft templates and word Using Outlook 2
W 'To' box blank when 'Replying' to an incoming email Using Outlook 1
W The 'To' line is Blank when 'replying' to an Outlook 2010 incoming email! Using Outlook 4
D DatabaseSize is blank? Exchange Server Administration 2
J Reply body blank Using Outlook 7
J Blank Inboxes in Outlook 2010 Using Outlook 3
S From Field is blank in sent messages that I set to save to folder other than Sent Items Using Outlook 1
Similar threads


















































Top