G
Gauthier
I've written some vba to send task requests from Excel 2003 (after activating
Outlook 2003 library). Everything works fine except the reminder checkbox
which remains empty although activating the ReminderSet property.
Sub SendBackupTaskToCustomer()
Dim StartingRow, RequestCount As Integer
Dim ExtractedDate As Date
Dim ExtractedAsset, ExtractedUser As String
Dim myOlApp As Outlook.Application
Dim myOlTask As Outlook.TaskItem
'verify action before starting to send task requests
If MsgBox("Send task request for " & Selection.Rows.Count & "
customers?", vbOKCancel) = vbCancel Then Exit Sub
Set myOlApp = CreateObject("Outlook.Application")
StartingRow = Selection.Row
For RequestCount = 0 To Selection.Rows.Count - 1
Set myOlTask = myOlApp.CreateItem(olTaskItem)
'get date from column A
ExtractedDate = Worksheets("Sheet1").Cells(StartingRow + RequestCount,
1).Value
'get asset id from column B and user from col D
ExtractedAsset = Worksheets("Sheet1").Cells(StartingRow +
RequestCount, 2).Value
ExtractedUser = Worksheets("Sheet1").Cells(StartingRow + RequestCount,
4).Value
If ExtractedUser = "" Or ExtractedAsset = "" Then
MsgBox ("Selection empty at row " & StartingRow + RequestCount & ".
Process stopped")
Exit Sub
End If
With myOlTask
'.From = "Migration XPSP2"
.Subject = "Migration: run backup.cmd to back up " & ExtractedAsset
& " documents before " & _
(ExtractedDate - 1)
.Body = "It is mandatory for the safety of your files that, the day
before migration, " & _
"you launch the process called Backup.cmd located as
defined below:" & vbCrLf & _
"M:\Sites\Braine\Migration\Tools\Backup.cmd"
.DueDate = ExtractedDate - 1
.Importance = olImportanceHigh
.ReminderSet = True
.ReminderTime = ExtractedDate - 2
.ReminderPlaySound = True
.ReminderSoundFile = "C:\Windows\Media\Ding.wav"
.Recipients.Add (ExtractedUser)
.Assign
.Send
End With
Set myOlTask = Nothing
Next RequestCount
Set myOlApp = Nothing
End Sub
Configuration: Windows XP SP2 + Office 2003 SP2/SP3
Outlook 2003 library). Everything works fine except the reminder checkbox
which remains empty although activating the ReminderSet property.
Sub SendBackupTaskToCustomer()
Dim StartingRow, RequestCount As Integer
Dim ExtractedDate As Date
Dim ExtractedAsset, ExtractedUser As String
Dim myOlApp As Outlook.Application
Dim myOlTask As Outlook.TaskItem
'verify action before starting to send task requests
If MsgBox("Send task request for " & Selection.Rows.Count & "
customers?", vbOKCancel) = vbCancel Then Exit Sub
Set myOlApp = CreateObject("Outlook.Application")
StartingRow = Selection.Row
For RequestCount = 0 To Selection.Rows.Count - 1
Set myOlTask = myOlApp.CreateItem(olTaskItem)
'get date from column A
ExtractedDate = Worksheets("Sheet1").Cells(StartingRow + RequestCount,
1).Value
'get asset id from column B and user from col D
ExtractedAsset = Worksheets("Sheet1").Cells(StartingRow +
RequestCount, 2).Value
ExtractedUser = Worksheets("Sheet1").Cells(StartingRow + RequestCount,
4).Value
If ExtractedUser = "" Or ExtractedAsset = "" Then
MsgBox ("Selection empty at row " & StartingRow + RequestCount & ".
Process stopped")
Exit Sub
End If
With myOlTask
'.From = "Migration XPSP2"
.Subject = "Migration: run backup.cmd to back up " & ExtractedAsset
& " documents before " & _
(ExtractedDate - 1)
.Body = "It is mandatory for the safety of your files that, the day
before migration, " & _
"you launch the process called Backup.cmd located as
defined below:" & vbCrLf & _
"M:\Sites\Braine\Migration\Tools\Backup.cmd"
.DueDate = ExtractedDate - 1
.Importance = olImportanceHigh
.ReminderSet = True
.ReminderTime = ExtractedDate - 2
.ReminderPlaySound = True
.ReminderSoundFile = "C:\Windows\Media\Ding.wav"
.Recipients.Add (ExtractedUser)
.Assign
.Send
End With
Set myOlTask = Nothing
Next RequestCount
Set myOlApp = Nothing
End Sub
Configuration: Windows XP SP2 + Office 2003 SP2/SP3