DISQUS

Reflections of my thoughts: http://www.codereflect.com/2006/06/forgot-to-mention-subject-in-outlook.html

  • Chris · 3 years ago
    Thanks for the nice macro, it really comes in handy!
  • jaco · 3 years ago
    I've applied the above steps, the code compiles, but nothing happens. I have restarted Outlook, but when I send a subject-less email, it gets sent, no prompt...

    Any ideas?
  • S a r a t h · 3 years ago
    It's working fine for me :)

    Check your macro security level.
  • jaco · 3 years ago
    Thanks, the security has to be set to Medium. It works, awesome!
  • qw411 · 3 years ago
    This works first time. When I restart the OL it does not do anything.

    Also you mentioned somthing regarding the macro securoty lvel. From where do i change it??
  • SAYEESH · 3 years ago
    even after setting the security level to "medium" it doesnt work. help me please
  • Vijay · 2 years ago
    Its cool. I have sent this macro to all my friends. Thanks a lot
  • Pravin Bhagat · 2 years ago
    I hv applied the above steps, the code compiles but nothing happenes. I have restarted outlook but I send a subject-less email, it get sent no prompt....
    and i have set the macro security is medium but nothing to useful
  • S a r a t h · 2 years ago
    It is working fine with Medium security settings in my outlook :(

    Which version of the outlook you are using?
  • Pravin Bhagat · 2 years ago
    Its working fine for my desktop PC but this macro can't run on Laptop, plz help me.
  • mathew · 2 years ago
    am using outlook 2003.. its givnig compilation error
  • Sarath · 2 years ago
    If you copy the same code, you will have compilation error. You may have to replace the " in the beginning and end of messagebox string. Please check it. It's the problem with wordpress.com to convert the " to stylish one, which is totally different character.
  • Joe Aiken · 2 years ago
    Took your coding and had one of our young engineers (Amy Dallas) modify it to incorporate the option to add a defined text string "ProjectText - " to the subject.

    ' Code originally by Sarath (http://sarathc.wordpress.com/2006/06/29/forgot-... Modified by Amy Dallas (adallas@transfieldworley.co.nz) 17-07-07

    Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
    Dim strSubject, strNewSubject As String
    strSubject = Item.Subject
    If Len(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
    If Left(strSubject, 14) = "ProjectText - " Then
    'Do nothing
    Else
    If MsgBox("Do you want to change the subject to:" & vbNewLine & "ProjectText - " & strSubject, vbYesNo) = vbYes Then
    Item.Subject = "ProjectText - " & strSubject
    Else
    strNewSubject = InputBox("Manually change the subject now if you wish", "Subject:", strSubject)
    If strNewSubject = strSubject Then
    Item.Subject = strNewSubject
    Else
    'No action required
    End If
    End If
    End If
    End Sub
  • Joe Aiken · 2 years ago
    Improved version of code.

    ' Code originally by Sarath (http://sarathc.wordpress.com/2006/06/29/forgot-... Modified by Amy Dallas (adallas@transfieldworley.co.nz) 17-07-07
    Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
    Dim strSubject, strNewSubject As String

    ' Edit string below for other projects
    Const strSubString = "ProjectText - "

    Dim iLen As Integer
    iLen = Len(strSubString)
    strSubject = Item.Subject
    If Len(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
    End If
    End If
    If Left(strSubject, iLen) = strSubString Then
    'Do nothing
    Else
    If MsgBox("Do you want to change the subject to:" & vbNewLine & strSubString & strSubject, vbYesNo) = vbYes Then
    Item.Subject = strSubString & strSubject
    Else
    strNewSubject = InputBox("Manually change the subject now if you wish", "Subject:", strSubject)
    If strNewSubject strSubject Then
    Item.Subject = strNewSubject
    Else
    End If
    End If
    End If
    End Sub
  • Mitchell · 2 years ago
    I am using 2007 and the altered code works great the first time! Just like before. Now that i have restarted outlook it no longer works! how do i make this run ALWAYS!

    This looks really helpful.

    Thanks
  • Joe Aiken · 2 years ago
    This could be due to the macro security you have operating - High level will only load Digitally Signed macros that you have accepted, but won't indicate anything. Medium level will ask you at startup of Outlook to enable the macro.

    To enable the macro to be run automatically at High security level you need to self-certify the macro by completing the following actions:
    a. Run "C:\Program Files\Microsoft Office\Office10\SelfCert.exe" to create a suitable digital signature certificate and enter your name as required.
    b. When finished go back into the VB editor in Oultook (Alt-F11).
    c. Select Tools/Digital Signature and 'Choose' to see the digital signature certificate you have just created.
    d. Select the certificate and click OK
    e. Save the Macro again and close the VB editor.
    f. Go to Tools/Macros/Security in the Outlook menus and ensure the security level is set to High.
    g. Close Outlook (save the macro again if asked) and Restart Outlook
    h. A 'certificate' window will appear asking if you want to enable a certified macro from a supplier - you. Tick the box for "all ways trust macros from this supplier" and enable the macro. This should enable the macro (and future macros you sign) to be loaded automatically whenever Outlook is started (on this PC) in the future.
  • JuanDaniel · 2 years ago
    @Joe Aiken, thanks for that info, i really needed it to load a macro that i made so as not to forget to attach files on emails!
  • Vibhu · 2 years ago
    This information on creating certificate was very helpful.
    Daniel..can u publish the macro you wrote to remember attaching files to a mail?
  • Rajimol · 1 year ago
    Thanks... I was searching for the same solution.. :-)
  • Steven · 1 year ago
    Do you have code that would prompt the user after using Send to "Save Email (Yes/No)?" and allow it to be saved to the Sent Items only if they select Yes?
  • Ray Thompson · 1 year ago
    I have created a similar macro, self-certified it, distributed it to other machines at my workplace, and imported my certificate on to their machines. They have checked the checkbox for "always trust macros from this publisher". However, if they reboot their machines, Outlook does not activate the macro I've written until such time as they select Tools-->Macro-->Visual Basic Editor from the menubar (and then simply close the screen). They are not prompted to "trust" the source anymore and the macro will work perfectly from that point on until they reboot their machine again. It's as if Outlook has to be reminded that the macro is there! We are using Outlook 2003 and our Security settings are at High. I've seen other postings mentioning a similar problem with Outlook. Has anyone found a solution other than the "activation" sequence I mentioned above?
  • Aftab · 1 year ago
    hi guys, the code given by you, just ask as a prompt, even we select No, it send the mail.
  • urvish · 1 year ago
    This does not work for outlook 2007
  • nascent · 1 year ago
    It works for outllok 2007 also.
    Go to Tools->Macro->Security. Select either "Warnings for all Macros" or "No security check for macros (Not recommended)". restart outlook and enjoy.
    If "Warnings for all Macros" is selected, whenever outlook is closed and opened, it will ask for either to "Enable Macros" or "Disable Macros". select "Enable Macros".
  • PrioroEaserne · 1 year ago
    Hi,
    My Name is, Joseph
    Nice site, verry informative
    check my site:

    http://ubSCTGF.spaces.live.com/
  • saikrishna.c · 1 year ago
    hi..
    I enabled this macro in my outlook, it is working fine. but, i don't know what mistake i did , i'm not receiving the mails immediatly after somebody sent(there is more than 15 min dealy...Previously it was working fine)and it is showing some error icon with red color when it is exchanging the mails with server.Can you please tell me how disable this macro or if possible can you provide the solution for this.
  • Nattu · 1 year ago
    Thanks a lot dude
  • Brandon · 10 months ago
    Works like a charm on Outlook 2007. Thanks Sarath
  • chris · 9 months ago
    Here are a few mods. In the original a reminder pops up but if you press ok the message is sent regardless. In this version you are either force to enter a subject or to cancel the email.



    Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
    Dim strSubject As String
    strSubject = Item.Subject
    If Len(strSubject) = 0 Then
    Prompt$ = "Name of user Wake up.....Subject is EMPTY!!!!!"
    If MsgBox(Prompt$, vbOK + vbQuestion + vbMsgBoxSetForeground, "Check for Subject") = vbOK Then
    Cancel = True
    End If
    End If
    End Sub
  • www.amandabrooke.net ยป Blog Ar · 9 months ago
    [...] http://sarathc.wordpress.com/2006/06/29/forgot-... Fatal error: Call to undefined function: similar_posts() in [...]
  • jamie · 7 months ago
    What am I doing wrong I get the following error

    Compile error:

    Syntax error

    I don't understand programing but i do forget to put in subjects

    Using Office 2007
  • Imran Shirolkar · 6 months ago
    Hi thanks a lot, Its working and its really very good :)
  • Vijay · 1 month ago
    Thanks it works,, next time while sending status i don't miss subject