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 - Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Need help to refine StampDate sub



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old September 18th 07, 09:12 PM posted to microsoft.public.outlook.program_forms
SCrowley
external usenet poster
 
Posts: 3
Default Need help to refine StampDate sub

I have searched the Web, Discussion Groups, Outlookcode.com and have found
most of my answer; however, I need help refining.

Outlook 2007 all service packs are up to date, Custom Contact Form

I found Sue Mosher's code for Sub StampDate() *see below, which Stamps the
date and user into the Notes field. Perfect! except I need stamp to appear in
the "Last Author" field from Field Chooser (I can't find the proper name for
it, may be ModifiedBy?)

Sue's Function

Item_Write
Item.BillingInformation = Application.Session.CurrentUser

might be the answer but I don't know where to write it. I tried the
Properties/Validation tab of the "Last Author" field and tried to write the
formula in the box but Item_Write is not an option.

I don't know which code to use or how to combine them to make them work.

Any ideas for this?

*Sub StampDate()
Dim objOL As Outlook.Application
Dim objNS As Outlook.NameSpace
Dim objItem As Object
Dim strStamp As String
On Error Resume Next
Set objOL = Application
Set objItem = objOL.ActiveInspector.CurrentItem
If Not objItem Is Nothing Then
Set objNS = objOL.Session
strStamp = Now & " - " & objNS.CurrentUser.Name
objItem.Body = objItem.Body & vbCrLf & strStamp
End If
Set objOL = Nothing
Set objNS = Nothing
Set objItem = Nothing
End Sub
--
Thank you,

scrowley(AT)littleonline.com
Ads
  #2  
Old September 19th 07, 12:17 AM posted to microsoft.public.outlook.program_forms
Sue Mosher [MVP-Outlook]
external usenet poster
 
Posts: 11,651
Default Need help to refine StampDate sub

Given that the ContactItem object has no built-in Last Author or ModifiedBy field, I'm not sure what you're referring to. If you add such a field to the custom form, you can access it through the UserProperties collection:

objItem.UserProperties("Last Author Stamp") = strStamp

--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


"SCrowley" wrote in message ...
I have searched the Web, Discussion Groups, Outlookcode.com and have found
most of my answer; however, I need help refining.

Outlook 2007 all service packs are up to date, Custom Contact Form

I found Sue Mosher's code for Sub StampDate() *see below, which Stamps the
date and user into the Notes field. Perfect! except I need stamp to appear in
the "Last Author" field from Field Chooser (I can't find the proper name for
it, may be ModifiedBy?)

Sue's Function

Item_Write
Item.BillingInformation = Application.Session.CurrentUser

might be the answer but I don't know where to write it. I tried the
Properties/Validation tab of the "Last Author" field and tried to write the
formula in the box but Item_Write is not an option.

I don't know which code to use or how to combine them to make them work.

Any ideas for this?

*Sub StampDate()
Dim objOL As Outlook.Application
Dim objNS As Outlook.NameSpace
Dim objItem As Object
Dim strStamp As String
On Error Resume Next
Set objOL = Application
Set objItem = objOL.ActiveInspector.CurrentItem
If Not objItem Is Nothing Then
Set objNS = objOL.Session
strStamp = Now & " - " & objNS.CurrentUser.Name
objItem.Body = objItem.Body & vbCrLf & strStamp
End If
Set objOL = Nothing
Set objNS = Nothing
Set objItem = Nothing
End Sub
--
Thank you,

scrowley(AT)littleonline.com

  #3  
Old September 21st 07, 07:08 PM posted to microsoft.public.outlook.program_forms
SCrowley
external usenet poster
 
Posts: 3
Default Need help to refine StampDate sub

It worked beautifully. THANK YOU SO MUCH!!

Final Code:
Sub StampDate()
Dim objOL As Outlook.Application
Dim objNS As Outlook.NameSpace
Dim objItem As Object
Dim strStamp As String
On Error Resume Next
Set objOL = Application
Set objItem = objOL.ActiveInspector.CurrentItem
If Not objItem Is Nothing Then
Set objNS = objOL.Session
strStamp = Now & " - " & objNS.CurrentUser.Name
objItem.UserProperties("Last Author Stamp") = strStamp
End If
Set objOL = Nothing
Set objNS = Nothing
Set objItem = Nothing
End Sub
--
Thank you,

scrowley(AT)littleonline.com


"Sue Mosher [MVP-Outlook]" wrote:

Given that the ContactItem object has no built-in Last Author or ModifiedBy field, I'm not sure what you're referring to. If you add such a field to the custom form, you can access it through the UserProperties collection:

objItem.UserProperties("Last Author Stamp") = strStamp

--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


"SCrowley" wrote in message ...
I have searched the Web, Discussion Groups, Outlookcode.com and have found
most of my answer; however, I need help refining.

Outlook 2007 all service packs are up to date, Custom Contact Form

I found Sue Mosher's code for Sub StampDate() *see below, which Stamps the
date and user into the Notes field. Perfect! except I need stamp to appear in
the "Last Author" field from Field Chooser (I can't find the proper name for
it, may be ModifiedBy?)

Sue's Function

Item_Write
Item.BillingInformation = Application.Session.CurrentUser

might be the answer but I don't know where to write it. I tried the
Properties/Validation tab of the "Last Author" field and tried to write the
formula in the box but Item_Write is not an option.

I don't know which code to use or how to combine them to make them work.

Any ideas for this?

*Sub StampDate()
Dim objOL As Outlook.Application
Dim objNS As Outlook.NameSpace
Dim objItem As Object
Dim strStamp As String
On Error Resume Next
Set objOL = Application
Set objItem = objOL.ActiveInspector.CurrentItem
If Not objItem Is Nothing Then
Set objNS = objOL.Session
strStamp = Now & " - " & objNS.CurrentUser.Name
objItem.Body = objItem.Body & vbCrLf & strStamp
End If
Set objOL = Nothing
Set objNS = Nothing
Set objItem = Nothing
End Sub
--
Thank you,

scrowley(AT)littleonline.com


 




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 10:59 AM.


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.