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

how to use vba



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old November 29th 08, 01:50 PM posted to microsoft.public.outlook.program_vba
paultip
external usenet poster
 
Posts: 3
Default how to use vba

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  
Old November 29th 08, 05:19 PM posted to microsoft.public.outlook.program_vba
paultip
external usenet poster
 
Posts: 3
Default how to use vba

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  
Old November 30th 08, 04:17 PM posted to microsoft.public.outlook.program_vba
JP[_3_]
external usenet poster
 
Posts: 201
Default how to use vba

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  
Old December 4th 08, 01:27 PM posted to microsoft.public.outlook.program_vba
paultip
external usenet poster
 
Posts: 3
Default how to use vba

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
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


All times are GMT +1. The time now is 08:26 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.