Hi Everyone and thanks in advance for your help,
I am trying to create a user-defined custom field with the userproperties.add method in vba outlook.
The idea is that when the user clicks on a macro button the field will show the current time with seconds included. I made the user-defined field with VBA Outlook but It gives the time with the following format, e.g. Thu 05/11/2015 09:23. I want to see the seconds as well
I created another user-defined field with Settings -> Columns -> ADD -> Test 1 with the idea to format UserDefinedFieldName to give the seconds. On the column properties I added: Format([UserDefinedFieldName],"ddd yyyy-mm-dd hh:mm:ss"). However it gives 0 seconds, which is not correct: Thu 05/11/2015 09:23:00.
How can I make a userdefined field which can give the seconds? Here is the code:
Please help me get the seconds! Any help will be much appreaciated!
I am trying to create a user-defined custom field with the userproperties.add method in vba outlook.
The idea is that when the user clicks on a macro button the field will show the current time with seconds included. I made the user-defined field with VBA Outlook but It gives the time with the following format, e.g. Thu 05/11/2015 09:23. I want to see the seconds as well
I created another user-defined field with Settings -> Columns -> ADD -> Test 1 with the idea to format UserDefinedFieldName to give the seconds. On the column properties I added: Format([UserDefinedFieldName],"ddd yyyy-mm-dd hh:mm:ss"). However it gives 0 seconds, which is not correct: Thu 05/11/2015 09:23:00.
How can I make a userdefined field which can give the seconds? Here is the code:
Code:
Dim UserDefinedFieldName As String
Set Folder = ActiveExplorer.CurrentFolder
If Folder.DefaultItemType = olMailItem Then
Set Selection = ActiveExplorer.Selection
If Selection.Count > 0 Then
For i = 1 To Selection.Count
Set oEmail = Selection(i)
Set objProperty = oEmail.UserProperties.Add(UserDefinedFieldName, Outlook.OlUserPropertyType.olDateTime)
objProperty.Value = Now()
oEmail.Save
End Sub
Please help me get the seconds! Any help will be much appreaciated!