![]() |
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. |
|
|
Thread Tools | Search this Thread | Display Modes |
#1
|
|||
|
|||
![]()
I am a novice vba programmer,not even put my foot on first step of ladder. I
have bought a book on VBA and Excel but I have an urgent requirement to date stamp my mail at work to protect myself. I found some code for a date stamp Sub StampContact() Dim objItem As Object Dim objNS As namespace Set objNS = Application.GetNamespace("MAPI") Set objItem = Application.ActiveInspector.CurrentItem If objItem.Class = olContact Then objItem.body = objItem.body & vbCrLf & Now() _ & " - " & objNS.CurrentUser End If Set objItem = Nothing Set objNS = Nothing End Sub I found the VB editor which created module 1 in outlook 2007 but the code appears to have a bug and I should like to know 2 things. 1. how to clean the bug up. Line 5 2. what to do with the module after creating it, and how to associate it to a toolbar button. I guess I am running before I can crawl - but there is nothing like jumping in at the deep end! Regards Paul |
Ads |
#2
|
|||
|
|||
![]()
PROBLEM SOLVED
"paultip" wrote: I am a novice vba programmer,not even put my foot on first step of ladder. I have bought a book on VBA and Excel but I have an urgent requirement to date stamp my mail at work to protect myself. I found some code for a date stamp Sub StampContact() Dim objItem As Object Dim objNS As namespace Set objNS = Application.GetNamespace("MAPI") Set objItem = Application.ActiveInspector.CurrentItem If objItem.Class = olContact Then objItem.body = objItem.body & vbCrLf & Now() _ & " - " & objNS.CurrentUser End If Set objItem = Nothing Set objNS = Nothing End Sub I found the VB editor which created module 1 in outlook 2007 but the code appears to have a bug and I should like to know 2 things. 1. how to clean the bug up. Line 5 2. what to do with the module after creating it, and how to associate it to a toolbar button. I guess I am running before I can crawl - but there is nothing like jumping in at the deep end! Regards Paul |
#3
|
|||
|
|||
![]()
For what it's worth, all incoming and outgoing messages are already
timestamped by Outlook. Just right-click an email in the explorer window and go to Options. Or if the email is already open for viewing, go to View Options. So what you are doing is unnecessary. --JP On Nov 29, 7:50*am, paultip wrote: I am a novice vba programmer,not even put my foot on first step of ladder.. I have bought a book on VBA and Excel but I have an urgent requirement to date stamp my mail at work to protect myself. I found some code for a date stamp Sub StampContact() * * Dim objItem As Object * * Dim objNS As namespace * * Set objNS = Application.GetNamespace("MAPI") * * Set objItem = Application.ActiveInspector.CurrentItem * * If objItem.Class = olContact Then * * * * objItem.body = objItem.body & vbCrLf & Now() _ * * * * * * * * & " - " & objNS.CurrentUser * * End If * * Set objItem = Nothing * * Set objNS = Nothing End Sub *I found the VB editor which created module 1 in outlook 2007 but the code appears to have a bug and I should like to know 2 things. 1. how to clean the bug up. Line 5 2. what to do with the module after creating it, and how to associate it to a toolbar button. I guess I am running before I can crawl - but there is nothing like jumping in at the deep end! Regards Paul |
#4
|
|||
|
|||
![]()
Thanks for the info, but I was already aware of that, this function is to
safeguard my position when the email is sent to several others and they can see a date/time along with the text of the mail. "JP" wrote: For what it's worth, all incoming and outgoing messages are already timestamped by Outlook. Just right-click an email in the explorer window and go to Options. Or if the email is already open for viewing, go to View Options. So what you are doing is unnecessary. --JP On Nov 29, 7:50 am, paultip wrote: I am a novice vba programmer,not even put my foot on first step of ladder.. I have bought a book on VBA and Excel but I have an urgent requirement to date stamp my mail at work to protect myself. I found some code for a date stamp Sub StampContact() Dim objItem As Object Dim objNS As namespace Set objNS = Application.GetNamespace("MAPI") Set objItem = Application.ActiveInspector.CurrentItem If objItem.Class = olContact Then objItem.body = objItem.body & vbCrLf & Now() _ & " - " & objNS.CurrentUser End If Set objItem = Nothing Set objNS = Nothing End Sub I found the VB editor which created module 1 in outlook 2007 but the code appears to have a bug and I should like to know 2 things. 1. how to clean the bug up. Line 5 2. what to do with the module after creating it, and how to associate it to a toolbar button. I guess I am running before I can crawl - but there is nothing like jumping in at the deep end! Regards Paul |
Thread Tools | Search this Thread |
Display Modes | |
|
|