Hello ,
May you help me for a little bug in my code ? I don't understand why, but when I run my code I got this error message :"Application-defined or object-defined error". This happen in this line : Set myDelegate = OutTask.Recipients.Add("alias")
Do you know what am I doing wrong ?
Have a nice day,
Thibaud
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Sub Create_Task(study As String, deadline As Date)
Dim myItem As Outlook.TaskItem
Dim myDelegate As Outlook.Recipients
Dim OutApp As Object
Dim OutMail As Object
Dim strbody As String
requester = Worksheets("control_vocabulary").Range("A1").Value
Set OutApp = CreateObject("Outlook.Application")
Set OutTask = OutApp.CreateItem(Outlook.OlItemType.olTaskItem)
ligne_users = 5
colonne_Study = Worksheets("Sponsors").Cells.Find(What:=study, After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Column
While Worksheets("Sponsors").Cells(ligne_users, colonne_Study).Value <> ""
sponsors = sponsors & ";" & Worksheets("Sponsors").Cells(ligne_users, colonne_Study).Value
ligne_users = ligne_users + 1
Wend
OutTask.Assign
Set myDelegate = OutTask.Recipients.Add("alias")
myDelegate.Resolve
If myDelegate.Resolved Then
With myItem
.Subject = study
.Body = "Deadline pour le test : " & study
.DueDate = deadline 'échéance
.ReminderTime = True 'Rappel
.Display
.Send
End With
End If
End Sub
May you help me for a little bug in my code ? I don't understand why, but when I run my code I got this error message :"Application-defined or object-defined error". This happen in this line : Set myDelegate = OutTask.Recipients.Add("alias")
Do you know what am I doing wrong ?
Have a nice day,
Thibaud
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Sub Create_Task(study As String, deadline As Date)
Dim myItem As Outlook.TaskItem
Dim myDelegate As Outlook.Recipients
Dim OutApp As Object
Dim OutMail As Object
Dim strbody As String
requester = Worksheets("control_vocabulary").Range("A1").Value
Set OutApp = CreateObject("Outlook.Application")
Set OutTask = OutApp.CreateItem(Outlook.OlItemType.olTaskItem)
ligne_users = 5
colonne_Study = Worksheets("Sponsors").Cells.Find(What:=study, After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Column
While Worksheets("Sponsors").Cells(ligne_users, colonne_Study).Value <> ""
sponsors = sponsors & ";" & Worksheets("Sponsors").Cells(ligne_users, colonne_Study).Value
ligne_users = ligne_users + 1
Wend
OutTask.Assign
Set myDelegate = OutTask.Recipients.Add("alias")
myDelegate.Resolve
If myDelegate.Resolved Then
With myItem
.Subject = study
.Body = "Deadline pour le test : " & study
.DueDate = deadline 'échéance
.ReminderTime = True 'Rappel
.Display
.Send
End With
End If
End Sub