Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 10-02-2015, 11:02 AM
Son Son is offline If Statement for Outlook VBA: Time & User defined columns Windows 8 If Statement for Outlook VBA: Time & User defined columns Office 2013
Novice
If Statement for Outlook VBA: Time & User defined columns
 
Join Date: Oct 2015
Posts: 1
Son is on a distinguished road
Question If Statement for Outlook VBA: Time & User defined columns

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
Reply With Quote
Reply

Tags
outlookvba; vba; outlook;



Similar Threads
Thread Thread Starter Forum Replies Last Post
If Statement for Outlook VBA: Time &amp; User defined columns FileSystemObject Compile Error: User-Defined Type Not Defined 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
If Statement for Outlook VBA: Time &amp; User defined columns User-defined Type not Defined VBA Issue OTPM Project 3 01-02-2014 01:47 PM
If Statement for Outlook VBA: Time &amp; User defined columns Excel 2003 User Defined Function Allan_H Excel 1 03-08-2013 09:36 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 07:17 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft