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

Outlook subject code.

Hi,

I have a code which warns me when there is no subject and i send a mail.

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

I get an error.

Can you help me sort this issue.

regards
Sharath
0
bsharath
Asked:
bsharath
  • 7
  • 3
1 Solution
 
Malli BoppeCommented:
promt$ isn't defined any where
you need to put a line just below private
dim prompt$

Where are you running this script
0
 
bsharathAuthor Commented:
Can you put in th editted script
0
 
bsharathAuthor Commented:
Full script here
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
Malli BoppeCommented:
hahaha

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

    Dim strSubject As String
      DIm prompt$

    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
0
 
bsharathAuthor Commented:
I get this error.

---------------------------
Microsoft Visual Basic
---------------------------
Compile error:

Expected End Sub
---------------------------
OK   Help  
---------------------------
0
 
Malli BoppeCommented:
Can you try this


Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
    Dim strSubject As String
    strSubject = Item.Subject
    If Len(Trim(strSubject)) = 0 Then
        If MsgBox("Subject is Empty. Are you sure you want to send the Mail?", vbYesNo + vbQuestion + vbMsgBoxSetForeground, Check for Subject) = vbNo Then
                Cancel = True
        End If
    End If
 End Sub
0
 
bsharathAuthor Commented:
I get this.

---------------------------
Microsoft Visual Basic
---------------------------
Compile error:

Expected End Sub
---------------------------
OK   Help  
---------------------------
0
 
bsharathAuthor Commented:
Any help...
0
 
bsharathAuthor Commented:
Any help....
0
 
bsharathAuthor Commented:
ANy help...
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

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