![]() |
#1
|
|||
|
|||
![]()
Hello,
I am new to VBA and i am finding If/Then statements difficult. I have tried to create this, but i am not sure if this is the correct way. I appreciate any help/suggestions to help me understand this a little better. What i would like to do is create an If statement for a User Defined Field Column in Outlook. I have created a User defined field column called "Overdue". I want to create an if then statement where, if an email is selected and has the value of "A" in UDF 2 and the flag status is not marked as complete; then there is a timer of 4 hours for this task to be completed- but the task timer should start as soon as the mail item reaches the mailbox. If this is not overdue, then Column "Overdue"(UDF4) will stay as "No", if this is Overdue; >4 hours, this column will be set as the value "Yes" Below is the code that i have been working on: Code:
For Each msg In myCollection If msg.FlagStatus = olFlagComplete Then End If If str2 = "A" + TaskDueDate = ReceivedTime > 4 Then 'check if received time is > than 4 hours ''''If Hour (?)()) < 4 Then (comment:alt line of code) msg.str4 = "Yes" 'if the received time for that message is more than 4 hours set Overdue column to say Yes Set objProperty = msg.UserProperties(udf(4)) If TaskDueDate = ReceivedTime < 4 Then msg.str4 = "No" Set objProperty = msg.UserProperties(udf(4)) If (objProperty Is Nothing) Then Set objProperty = msg.UserProperties.Add(udf(4), olKeywords) End If objProperty.value = "No"` msg.Save Next End If End If End Sub |
![]() |
Tags |
outlookvba; vba; outlook; |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
gsrikanth | Excel Programming | 2 | 03-28-2022 06:32 AM |
Add User Defined Fields to all contacts | markhughes7 | Outlook | 0 | 08-24-2015 02:07 PM |
User Defined Fields | daveybops | Outlook | 1 | 05-06-2014 10:25 AM |
![]() |
OTPM | Project | 3 | 01-02-2014 01:47 PM |
![]() |
Allan_H | Excel | 1 | 03-08-2013 09:36 AM |