how to use vba

P

paultip

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
 
J

JP

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
 
P

paultip

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top