Mrrrr's Forum (VIEW ONLY)
Un forum care ofera solutii pentru unele probleme legate in general de PC. Pe langa solutii, aici puteti gasi si alte lucruri interesante // A forum that offers solutions to some PC related issues. Besides these, here you can find more interesting stuff.
|
Lista Forumurilor Pe Tematici
|
Mrrrr's Forum (VIEW ONLY) | Reguli | Inregistrare | Login
POZE MRRRR'S FORUM (VIEW ONLY)
Nu sunteti logat.
|
Nou pe simpatie: sexy_andrea2006 pe Simpatie.ro
| Femeie 22 ani Sibiu cauta Barbat 22 - 48 ani |
|
TRaP
Moderator
Inregistrat: acum 6 ani
Postari: 787
|
|
Sub CreateTasks()
Dim ol As Object, olTask As Object Dim sd, dd, rd As Date 'sd = start date dd = due date rd = reminder date
Set ol = CreateObject("Outlook.Application") Set olTask = ol.CreateItem(3)
dd = InputBox("Due date: dd.mm.yyyy")
If StrPtr(dd) = 0 Then Exit Sub ElseIf dd = vbNullString Then MsgBox "No date inserted, code exits", vbOKOnly, "Error" Exit Sub End If
If IsDate(dd) Then dd = Format(CDate(dd), "dd.mm.yyyy") Else MsgBox "Wrong date format, code exits", vbOKOnly, "Error" Exit Sub End If
sd = Format(CDate(Now()), "dd.mm.yyyy") rd = DateAdd("d", -7, dd)
' if due date before start date (which is today) - due date cannot be set in the past If CDate(dd) < CDate(sd) Then MsgBox "Due date cannot be set before start date, code exits", vbOKOnly, "Error" Exit Sub End If
' if reminder date before start date (which is today) - if due date is set in 3 days, reminder can be 4 days before today If CDate(rd) < CDate(sd) Then MsgBox "Reminder date is by default due date - 7 days. " & _ "Since due date is in less than 7 days from today, reminder is set for tomorrow", vbOKOnly, "Information" rd = DateAdd("d", 1, sd) End If
With olTask .Subject = InputBox("Subject") .StartDate = sd .DueDate = dd .Status = 0 .Importance = 1 .ReminderSet = True .ReminderPlaySound = True .ReminderTime = rd & " " & "09:00" .Categories = "Red Category" .Body = "" .Display End With
End Sub
|
Original code source:
More VBA options for TaskItem:
|
|
pus acum 1 an |
|