How to Auto Preset Today as the Start Date of a New Task in Your Outlook

Поделись сейчас:

When creating a new task in Outlook, if you frequently need to set today as its start date, you must wish Outlook to auto accomplish it. This article will look at this requirement to provide an easy method.

By default, when you click create a new task in your Outlook, the task will display with “Start date” set to “None”, as shown in the following figure. However, more often than not, you’re accustomed to setting the start date to the current date. So, you have to manually input or select the date in “Start date” field. In face of such a scenario, you may hope that Outlook can automatically preset today as the start date pf new task. Though there is not such a direct function, you still can get it by the shared VBA code thereinafter. If you are not familiar with VBA, please refer to “Как запустить код VBA в Outlook" тем временем.

Default "None" Start Date

Auto Preset Today as the Start Date of a New Task

  1. Для начала запустите приложение Outlook.
  2. Затем нажмите «Alt + F11», чтобы запустить редактор Outlook VBA.
  3. Затем скопируйте следующий код в проект ThisOutlookSession.
Public WithEvents objInspectors As Outlook.Inspectors
Public WithEvents objTask As Outlook.TaskItem

Private Sub Application_Startup()
    Set objInspectors = Outlook.Application.Inspectors
End Sub

Private Sub objInspectors_NewInspector(ByVal Inspector As Inspector)
    If TypeOf Inspector.CurrentItem Is TaskItem Then
       Set objTask = Inspector.CurrentItem
    End If
End Sub

Private Sub objTask_Open(Cancel As Boolean)
    'When opening a fresh new task item
    If Len(objTask.Subject) = 0 And Len(objTask.Body) = 0 And objTask.startDate = #1/1/4501# And objTask.DueDate = #1/1/4501# Then
 
       'Set start date to today
       objTask.startDate = Date
    End If
End Sub

VBA Code - Auto Preset Today as the Start Date of a New Task

  1. After that, move the cursor to the first “Application_Startup” subroutine.
  2. Позже нажмите кнопку «F5».
  3. Since then, every time when you create a new task, Outlook will auto set the start date to the current date, namely today, as shown in the following image.Auto Preset Today as Start Date

Остерегайтесь вредоносных макросов в Outlook

Хотя макрос VBA предоставляет пользователям много удобства и возможностей, он также приводит ко многим потенциальным рискам. Например, если вы настроили параметры макросов, чтобы разрешить все макросы без уведомления, когда электронное письмо с вредоносными макросами поступает в ваш почтовый ящик и вы открываете встроенные ссылки, ваш файл данных Outlook, как правило, подвергается атаке вирусов. В это время вы должны убить вирусы и попытаться Восстановление Outlook. Most of time, the inbuilt tool – Scanpst cannot be up to this assignment. So, you ought to call in a more robust utility, such as DataNumen Outlook Repair.

Об авторе:

Ширли Чжан — эксперт по восстановлению данных в DataNumen, Inc., которая является мировым лидером в области технологий восстановления данных, включая sql восстановление и программные продукты для ремонта Outlook. Для получения дополнительной информации посетите www.datanumen.com

Поделись сейчас:

Комментарии закрыты.