1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Date Macro for Outlook 2003

Discussion in 'Business Applications' started by jbl366, Oct 9, 2009.

Thread Status:
Not open for further replies.
Advertisement
  1. jbl366

    jbl366 Thread Starter

    Joined:
    Oct 9, 2009
    Messages:
    15
    Hi there,

    I am trying to get a macro for Outlook 2003 that when I compose a new email in Outlook 2003, the date will appear in the subject line automatically in the following format:
    20101009-
    I have tried looking into it in Outlook but it says that macros will not work in Outlook and I have to do in in VB Editor. Unfortunately I am a complete novice (or noob as my son would call me) with VB Editor.
    Would anyone be able to help me out please?

    :confused:
     
  2. Rollin_Again

    Rollin_Again

    Joined:
    Sep 4, 2003
    Messages:
    4,912
    As far as I know there is no way to do this when you click the New Mail button within Outlook. The only way I know how to do this is to use a macro within Outlook to create the new email and display it. In other words, when you want to start a new email you would have to run the macro instead of clicking the NEW MAIL button. Would that work for you?

    Regards,
    Rollin
     
  3. jbl366

    jbl366 Thread Starter

    Joined:
    Oct 9, 2009
    Messages:
    15
    Hi Rollin,

    It can be done as I have seen it done when I was serving in the Armed Forces. Some clever person created a macro where when you pressed the new mail button, a new email window opened with the date in and also a classfication which you could change:

    20091009-(you enter the subject in here)-R (or U).

    Unfortunately I no longer work there and am unable to find it anywhere.
    If it was defaulted to insert the date then I would not forget to add it in (nor the people who work for me!)
     
  4. Rollin_Again

    Rollin_Again

    Joined:
    Sep 4, 2003
    Messages:
    4,912
    Was the button he was clicking the default new mail button or did he create a custom button for this purpose?

    Regards,
    Rollin
     
  5. jbl366

    jbl366 Thread Starter

    Joined:
    Oct 9, 2009
    Messages:
    15
    It was the original new mail button and not a custom one.
     
  6. jbl366

    jbl366 Thread Starter

    Joined:
    Oct 9, 2009
    Messages:
    15
    Hi Rollin,

    Could you please let me know how I could do it by adding a new button please?
     
  7. Rollin_Again

    Rollin_Again

    Joined:
    Sep 4, 2003
    Messages:
    4,912
    Open Outlook and press ALT + F11 to open the VB editor. Click INSERT >>MODULE and then copy and paste the code below into the blank module window (Replace the portion in red with your actual subject line)

    After making these changes close the VB editor and get back to the main Outlook Window. Next create your button by right clicking on the toolbar and choosing CUSTOMIZE. On the left hand side of the customize window will be a list of categories. Scroll down and choose the option MACROS. Once you select the macros option you will see a list of existing macros in Outlook on the right hand side. Locate the one called "CreateMail" and click and drag it onto the toolbar at the top.

    Once this new button is created you can right click it and change the button text and button image. After making your changes close the customize menu box and you should be good to go.



    Code:
    Sub CreateMail()
                
    Dim objOutlookMsg As Outlook.MailItem
    Set objOutlookMsg = Application.CreateItem(olMailItem)
    objOutlookMsg.Subject = Year(Date) & Month(Date) & Day(Date) & " - [COLOR="Red"]TEST SUBJECT[/COLOR]"
    objOutlookMsg.Display
          
    End Sub


    Regards,
    Rollin
     
  8. jbl366

    jbl366 Thread Starter

    Joined:
    Oct 9, 2009
    Messages:
    15
    Tks Rollin.

    That works a treat!
     
  9. Rollin_Again

    Rollin_Again

    Joined:
    Sep 4, 2003
    Messages:
    4,912
    Glad to help out! I'm still curious about how to set the text of the subject line when the default new mail button is clicked. I've tried numerous things with code but nothing has worked so far. I'll keep you posted since I am determined to figure it out since you already stated that it can be done!

    Regards,
    Rollin
     
  10. Sponsor

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Loading...
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/867198

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice