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.

Solved: Editing Macro Date for Outlook 2003

Discussion in 'Business Applications' started by jbl366, Feb 2, 2010.

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

    jbl366 Thread Starter

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

    Previously I requested assistance in 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-

    Member Rollin_Again very kindly gave me the following data:

    Sub CreateMail()

    Dim objOutlookMsg As Outlook.MailItem
    Set objOutlookMsg = Application.CreateItem(olMailItem)
    objOutlookMsg.Subject = Year(Date) & Month(Date) & Day(Date) & " - TEST SUBJECT"
    objOutlookMsg.Display

    End Sub

    It works apart from now a new year has started, the month only date only appear as a single figure if less that 10 (eg 201011 rather than 20100101)
    I have tried editing with it but no joy.

    Can anyone help please?

     
  2. maxx_eclipse

    maxx_eclipse

    Joined:
    May 28, 2007
    Messages:
    291
    Not necessarily fixing the macro problem, but have you considered using forward slashes in the email title, so then at least that way, the date and month can be distinguished?

    If so, what you'll need to do is change:

    objOutlookMsg.Subject = Year(Date) & Month(Date) & Day(Date) & " - TEST SUBJECT"

    to

    objOutlookMsg.Subject = Year(Date) & "/" & Month(Date) & "/" & Day(Date) & " - TEST SUBJECT"
     
  3. jbl366

    jbl366 Thread Starter

    Joined:
    Oct 9, 2009
    Messages:
    15
    Tks Maxx,

    I tried that but would like it to appear without slashes as that is how the MOD want it to be.:(
     
  4. maxx_eclipse

    maxx_eclipse

    Joined:
    May 28, 2007
    Messages:
    291
    Ah, right.

    Seems rather strange that the macro just reformats the month and date entries. Have you had a look at settings in Office to see how the date is displayed elsewhere? I know that things like Excel have various formats of date presentation, so I'm wondering if Outlook might have the same. Have you checked?
     
  5. jbl366

    jbl366 Thread Starter

    Joined:
    Oct 9, 2009
    Messages:
    15
    Just checked and cannot seem to find anything. After reading the Help options, I tried editing the script to (Date$) for the day and month but no joy. :(
     
  6. maxx_eclipse

    maxx_eclipse

    Joined:
    May 28, 2007
    Messages:
    291
    Hmm... Best I leave this matter to someone else. Have you tried sending Rollin_Again a message?
     
  7. Rollin_Again

    Rollin_Again

    Joined:
    Sep 4, 2003
    Messages:
    4,912
    You rang??

    Regards,
    Rollin
     
  8. jbl366

    jbl366 Thread Starter

    Joined:
    Oct 9, 2009
    Messages:
    15
    Rollin_Again,

    You Sir are a star! It works a treat!

    VMTS

    JBL366[​IMG][​IMG]
     
  9. 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...
Similar Threads - Solved Editing Macro
  1. ImaGrump
    Replies:
    209
    Views:
    2,770
  2. jassy6939
    Replies:
    1
    Views:
    338
Thread Status:
Not open for further replies.

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

  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