A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Date Stamp in SUBJECT BOX of Outgoing/Incoming Mail



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old August 7th 09, 03:11 PM posted to microsoft.public.outlook.program_vba
Glen.Cooper[_3_]
external usenet poster
 
Posts: 1
Default Date Stamp in SUBJECT BOX of Outgoing/Incoming Mail


Hi Ken,

Sorry, same error :-(

Anything else?

Glen


--
Glen.Cooper
------------------------------------------------------------------------
Glen.Cooper's Profile: http://www.thecodecage.com/forumz/member.php?userid=613
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=121980

  #2  
Old August 7th 09, 03:25 PM posted to microsoft.public.outlook.program_vba
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default Date Stamp in SUBJECT BOX of Outgoing/Incoming Mail

If this is Outlook 2003 or earlier then change the declaration in
Application_NewMailEx() on the line:

Dim myInbox As folder

To this:

Dim myInbox As MAPIFolder

Make sure no lines are showing in red in case any line breaks were added
that split lines of code.

If that doesn't help then what line is highlighted on the error?

This is being put into the Outlook VBA project?

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"Glen.Cooper" wrote in message
...

Hi Ken,

Sorry, same error :-(

Anything else?

Glen


--
Glen.Cooper
------------------------------------------------------------------------
Glen.Cooper's Profile:
http://www.thecodecage.com/forumz/member.php?userid=613
View this thread:
http://www.thecodecage.com/forumz/sh...d.php?t=121980


  #3  
Old August 7th 09, 03:42 PM posted to microsoft.public.outlook.program_vba
Glen.Cooper[_4_]
external usenet poster
 
Posts: 1
Default Date Stamp in SUBJECT BOX of Outgoing/Incoming Mail


Hi Ken,

Yes that has helped the code along. Thankyou!

Now there is a syntax error in Module1:

Set GetCurrentItem =

Any suggestions?

Glen


--
Glen.Cooper
------------------------------------------------------------------------
Glen.Cooper's Profile: http://www.thecodecage.com/forumz/member.php?userid=613
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=121980

  #4  
Old August 7th 09, 05:31 PM posted to microsoft.public.outlook.program_vba
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default Date Stamp in SUBJECT BOX of Outgoing/Incoming Mail

Make sure no lines are showing in red in case any line breaks were added
that split lines of code.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"Glen.Cooper" wrote in message
...

Hi Ken,

Yes that has helped the code along. Thankyou!

Now there is a syntax error in Module1:

Set GetCurrentItem =

Any suggestions?

Glen


--
Glen.Cooper
------------------------------------------------------------------------
Glen.Cooper's Profile:
http://www.thecodecage.com/forumz/member.php?userid=613
View this thread:
http://www.thecodecage.com/forumz/sh...d.php?t=121980


  #5  
Old August 10th 09, 09:18 AM posted to microsoft.public.outlook.program_vba
Glen.Cooper[_5_]
external usenet poster
 
Posts: 1
Default Date Stamp in SUBJECT BOX of Outgoing/Incoming Mail


Hi Guys, thanks for all your help so far :-)

Here below is the script which works well enough:

Private Sub Application_ItemSend(ByVal Item As Object, Cancel As
Boolean)
If TypeName(Item) = "MailItem" Then
Dim strSubject As String
strSubject = Item.Subject
Item.Subject = Item.SenderName & " " & Date & " " & Item.Subject
End If
End Sub
Private Sub Application_NewMailEx(ByVal EntryIDCollection As String)
Dim myNameSpace As NameSpace
Dim myInbox As MAPIFolder
Dim myItem As Object
Dim strSubject As String
Set myNameSpace = Application.GetNamespace("MAPI")
Set myInbox = myNameSpace.GetDefaultFolder(olFolderInbox)
For i = 1 To myInbox.Items.Count
Set myItem = myInbox.Items.Item(i)
If myItem.EntryID = EntryIDCollection Then Exit For
Next
strSubject = myItem.Subject
myItem.Subject = myItem.SenderName & " " & Date & " " & myItem.Subject
myItem.Save
End Sub

Exceptions are that the macro does not seem to work unless the mail has
been recieved while you are online and running OUTLOOK at the same time.
Perhaps this macro has to be run from a constanlty working server to
make sure that ALL emails are date stamped.

For all those email that arrive out of hours or when you are not at the
machine, use:

Sub Date_Stamp_Subject()
Dim myItem As MailItem
Dim strSubject As String
Set myItem = GetCurrentItem()
myItem.Subject = myItem.SenderName & " " & myItem.CreationTime & " " &
myItem.Subject
myItem.Save
End Sub
Function GetCurrentItem() As Object
Dim objApp As Outlook.Application
Set objApp = Application
On Error Resume Next
Select Case TypeName(objApp.ActiveWindow)
Case "Explorer"
Set GetCurrentItem = objApp.ActiveExplorer.Selection.Item(1)
Case "Inspector"
Set GetCurrentItem = objApp.ActiveInspector.CurrentItem
End Select
Set objApp = Nothing
End Function

This works well, BUT it date stamps the mail with the information in
the following format - *SENDERNAME YYYYMMDD HHMMSS*. I definitelty do
not need this amount of information!

Does anyone know how I can reduce the stamp to this alone?

SENDERNAME YYMMDD

Any help would be very much appreciated :-)

Thanks again.

Glen


--
Glen.Cooper
------------------------------------------------------------------------
Glen.Cooper's Profile: http://www.thecodecage.com/forumz/member.php?userid=613
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=121980

  #6  
Old August 10th 09, 03:03 PM posted to microsoft.public.outlook.program_vba
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default Date Stamp in SUBJECT BOX of Outgoing/Incoming Mail

Use the Format function for that. In this case you'd probably want the
format to look like this:

Format(date, "yymmdd")

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"Glen.Cooper" wrote in message
...

Hi Guys, thanks for all your help so far :-)

Here below is the script which works well enough:

Private Sub Application_ItemSend(ByVal Item As Object, Cancel As
Boolean)
If TypeName(Item) = "MailItem" Then
Dim strSubject As String
strSubject = Item.Subject
Item.Subject = Item.SenderName & " " & Date & " " & Item.Subject
End If
End Sub
Private Sub Application_NewMailEx(ByVal EntryIDCollection As String)
Dim myNameSpace As NameSpace
Dim myInbox As MAPIFolder
Dim myItem As Object
Dim strSubject As String
Set myNameSpace = Application.GetNamespace("MAPI")
Set myInbox = myNameSpace.GetDefaultFolder(olFolderInbox)
For i = 1 To myInbox.Items.Count
Set myItem = myInbox.Items.Item(i)
If myItem.EntryID = EntryIDCollection Then Exit For
Next
strSubject = myItem.Subject
myItem.Subject = myItem.SenderName & " " & Date & " " & myItem.Subject
myItem.Save
End Sub

Exceptions are that the macro does not seem to work unless the mail has
been recieved while you are online and running OUTLOOK at the same time.
Perhaps this macro has to be run from a constanlty working server to
make sure that ALL emails are date stamped.

For all those email that arrive out of hours or when you are not at the
machine, use:

Sub Date_Stamp_Subject()
Dim myItem As MailItem
Dim strSubject As String
Set myItem = GetCurrentItem()
myItem.Subject = myItem.SenderName & " " & myItem.CreationTime & " " &
myItem.Subject
myItem.Save
End Sub
Function GetCurrentItem() As Object
Dim objApp As Outlook.Application
Set objApp = Application
On Error Resume Next
Select Case TypeName(objApp.ActiveWindow)
Case "Explorer"
Set GetCurrentItem = objApp.ActiveExplorer.Selection.Item(1)
Case "Inspector"
Set GetCurrentItem = objApp.ActiveInspector.CurrentItem
End Select
Set objApp = Nothing
End Function

This works well, BUT it date stamps the mail with the information in
the following format - *SENDERNAME YYYYMMDD HHMMSS*. I definitelty do
not need this amount of information!

Does anyone know how I can reduce the stamp to this alone?

SENDERNAME YYMMDD

Any help would be very much appreciated :-)

Thanks again.

Glen


--
Glen.Cooper
------------------------------------------------------------------------
Glen.Cooper's Profile:
http://www.thecodecage.com/forumz/member.php?userid=613
View this thread:
http://www.thecodecage.com/forumz/sh...d.php?t=121980


  #7  
Old August 24th 09, 02:58 PM posted to microsoft.public.outlook.program_vba
Glen.Cooper[_6_]
external usenet poster
 
Posts: 1
Default Date Stamp in SUBJECT BOX of Outgoing/Incoming Mail


'Ken Slovak - [MVP - Outlook Wrote:
;447425']Use the Format function for that. In this case you'd probably
want the
format to look like this:

Format(date, "yymmdd")

--
Ken Slovak
[MVP - Outlook]
'Slovak Technical Services Home' (http://www.slovaktech.com)
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
'Slovak Technical Services Products'
(http://www.slovaktech.com/products.htm)


"Glen.Cooper" wrote in message
...

Hi Guys, thanks for all your help so far :-)

Here below is the script which works well enough:

Private Sub Application_ItemSend(ByVal Item As Object, Cancel As
Boolean)
If TypeName(Item) = "MailItem" Then
Dim strSubject As String
strSubject = Item.Subject
Item.Subject = Item.SenderName & " " & Date & " " & Item.Subject
End If
End Sub
Private Sub Application_NewMailEx(ByVal EntryIDCollection As String)
Dim myNameSpace As NameSpace
Dim myInbox As MAPIFolder
Dim myItem As Object
Dim strSubject As String
Set myNameSpace = Application.GetNamespace("MAPI")
Set myInbox = myNameSpace.GetDefaultFolder(olFolderInbox)
For i = 1 To myInbox.Items.Count
Set myItem = myInbox.Items.Item(i)
If myItem.EntryID = EntryIDCollection Then Exit For
Next
strSubject = myItem.Subject
myItem.Subject = myItem.SenderName & " " & Date & " " &

myItem.Subject
myItem.Save
End Sub

Exceptions are that the macro does not seem to work unless the mail

has
been recieved while you are online and running OUTLOOK at the same

time.
Perhaps this macro has to be run from a constanlty working server to
make sure that ALL emails are date stamped.

For all those email that arrive out of hours or when you are not at

the
machine, use:

Sub Date_Stamp_Subject()
Dim myItem As MailItem
Dim strSubject As String
Set myItem = GetCurrentItem()
myItem.Subject = myItem.SenderName & " " & myItem.CreationTime & " "

&
myItem.Subject
myItem.Save
End Sub
Function GetCurrentItem() As Object
Dim objApp As Outlook.Application
Set objApp = Application
On Error Resume Next
Select Case TypeName(objApp.ActiveWindow)
Case "Explorer"
Set GetCurrentItem = objApp.ActiveExplorer.Selection.Item(1)
Case "Inspector"
Set GetCurrentItem = objApp.ActiveInspector.CurrentItem
End Select
Set objApp = Nothing
End Function

This works well, BUT it date stamps the mail with the information in
the following format - *SENDERNAME YYYYMMDD HHMMSS*. I definitelty

do
not need this amount of information!

Does anyone know how I can reduce the stamp to this alone?

SENDERNAME YYMMDD

Any help would be very much appreciated :-)

Thanks again.

Glen


--
Glen.Cooper

------------------------------------------------------------------------
Glen.Cooper's Profile:
'The Code Cage Forums - View Profile: Glen.Cooper'

(http://www.thecodecage.com/forumz/member.php?userid=613)
View this thread:
'Date Stamp in SUBJECT BOX of Outgoing/Incoming Mail - The Code Cage

Forums' (http://www.thecodecage.com/forumz/sh...d.php?t=121980)


Hi,

Can you tell me how to write into the code above a way to change the
format to YYYY/MM/DD please?

I cannot figure it out...

glen


--
Glen.Cooper
------------------------------------------------------------------------
Glen.Cooper's Profile: http://www.thecodecage.com/forumz/member.php?userid=613
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=121980

 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I find the Incoming and outgoing Mail Server Lisa Outlook - Installation 1 March 4th 07 12:57 AM
names of incoming and outgoing mail servers noname Outlook Express 1 November 19th 06 02:16 AM
Error Messages with incoming/outgoing mail Kyle JP Outlook Express 6 November 18th 06 12:19 AM
Need server name for outgoing and incoming mail Jerry Robertson Outlook Express 2 August 21st 06 01:27 AM
Foreign language in the date of my outgoing/incoming messages Jeffrey Brown Outlook - Installation 0 March 27th 06 11:57 PM


All times are GMT +1. The time now is 06:54 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.