Outlook’a Task Acma – Guncelleme

Outlooktaki goruntusude yukaridaki sekilde olacaktir.

Asagida ekran goruntunu gordugunuz sekilde bir dosyadan outlook uzerinde task’lar acmaya ve guncellemeye yonelik bir calisma paylasiyorum.

Outlook_Task_Acma_Excel

Task Yaratma;

[kleo_tabs centered=””] [kleo_tab title=”Task Yaratma” active=0]

[kleo_colored_text color=”#F00056″]

Option Explicit

Sub Create_Task()
‘Microsoft Object Library x.x referansi tool menusunden acilmali..

Dim olApp As Outlook.Application
Dim olTask As Outlook.TaskItem
Dim olItemToChange As Outlook.TaskItem
Dim olNS As Object
Dim olItems As Object
Dim Table_Start, Table_Finish As Integer
Dim X As Long

Set olApp = New Outlook.Application

Application.ScreenUpdating = False
‘ActiveSheet.Unprotect

Table_Start = ActiveSheet.ListObjects(“Tasks”).Range.Row + 1
Table_Finish = Table_Start + ActiveSheet.ListObjects(“Tasks”).Range.Rows.Count – 2

For X = Table_Start To Table_Finish
Set olNS = olApp.GetNamespace(“MAPI”)
‘Set olTask = olNS.GetDefaultFolder(13).Items
‘Set olItemToChange = olItems.Find(“[Subject] = DDDD”)
On Error Resume Next
Set olItemToChange = Nothing
Set olItemToChange = olNS.GetItemFromID(Cells(X, ActiveSheet.Range(“Tasks[ID]”).Column).Value)
‘olTask .Find(“[EntryID] = ‘FFF'”) ‘& Cells(X, “N”).Value)
‘If Cells(X, “N”).Value = “” Then
If olItemToChange Is Nothing Then

Set olTask = olApp.CreateItem(3)
With olTask
.Subject = Cells(X, ActiveSheet.Range(“Tasks[Description]”).Column).Value
.Body = Cells(X, ActiveSheet.Range(“Tasks[Content]”).Column).Value
.StartDate = Cells(X, ActiveSheet.Range(“Tasks[Start Date]”).Column).Value
.DueDate = Cells(X, ActiveSheet.Range(“Tasks[Due Date]”).Column).Value
.Status = olTaskWaiting
.Importance = olImportanceHigh
.ReminderSet = True
.ReminderTime = Cells(X, ActiveSheet.Range(“Tasks[Reminder]”).Column).Value
.ReminderPlaySound = True
.Save
End With
Cells(X, ActiveSheet.Range(“Tasks[ID]”).Column).Value = olTask.EntryID
End If
Next

Set olTask = Nothing
Set olApp = Nothing

Application.ScreenUpdating = True

MsgBox “Tasks have been successfully created..”, vbInformation
‘ActiveSheet.Protect DrawingObjects:=False, Contents:=True, Scenarios:=False
End Sub

[/kleo_colored_text]

[/kleo_tab]

[kleo_tab title=”Task Guncelleme” active=1]

[kleo_colored_text color=”#44444″]

Dim bWeStartedOutlook As Boolean

Function Update_Task(strName As String, dteDate As Date) As Boolean
‘ – hatirlatma tarihi ve son tarih ayni ise, fonksiyon ikisinide yeniler..
‘ – Outlookun acilip kapanmasi ile islem gerceklesir..

‘ (VBA) ile Kullanma:
‘ Dim task_guncelle As Boolean
‘ task_guncelle = Update_Task(“Konu”, “01/10/2010”)
‘ (KTF) Kullanimi:
‘ =Update_Task(“Konu”, “01/10/2010”)
‘ yada
‘ =Update_Task(A1, B1)
‘ A1 Konu oldugunda, B1 tarih oldugunda..

Dim olApp As Object
Dim olNS As Object
Dim olItems As Object
Dim olItemToChange As Object

‘ Hatirlatma tarihi gecmis olamaz..
If dteDate < Now Then
Update_Task = False
GoTo ExitProc
End If

On Error Resume Next
Set olApp = GetOutlookApp
On Error GoTo 0

If Not olApp Is Nothing Then
Set olNS = olApp.GetNamespace(“MAPI”)
Set olItems = olNS.GetDefaultFolder(13).Items
Set olItemToChange = olItems.Find(“[Subject] = ” & strName)
‘Tum konularin ayni olmasini isterseniz: Set olItemToChange = olItems.Item(strName)

If olItemToChange Is Nothing Then
Update_Task = False
GoTo ExitProc
End If

With olItemToChange
‘ Hatirlatma tarihi ve son tarih ayni ise ikisinide degistir
‘ yoksa hatirlatma tarihini degistir
If .ReminderTime = .DueDate Then
.ReminderTime = dteDate
.DueDate = dteDate
Else
.ReminderTime = dteDate
End If
.Save
End With

Update_Task = True
GoTo ExitProc

Else
Update_Task = False
GoTo ExitProc
End If

ExitProc:
If bWeStartedOutlook Then
olApp.Quit
End If
Set olApp = Nothing
Set olNS = Nothing
End Function

Function GetOutlookApp() As Object
On Error Resume Next
Set GetOutlookApp = GetObject(, “Outlook.Application”)
If Err.Number <> 0 Then
Set GetOutlookApp = CreateObject(“Outlook.Application”)
bWeStartedOutlook = True
End If
On Error GoTo 0
End Function

[/kleo_colored_text]

[/kleo_tab] [/kleo_tabs][kleo_tabs centered=””]

Outlook’a Task Acma – Guncelleme

Yazar: mmustafaaslan

2004 yilindan itibaren ozel bir sirketin finans departmaninda calismaktadir. Kendini excel, visual basic kullaniminda gelistirmis olan yazarimiz; Meslegi geregi SAP konusunda ileri derecede bilgilidir.

Bir Cevap Yazın

E-posta hesabınız yayımlanmayacak. Gerekli alanlar * ile işaretlenmişlerdir


1 + 9 =