A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Create task request from Excel: reminder problem



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old January 14th 08, 11:01 AM posted to microsoft.public.outlook.program_vba
Gauthier
external usenet poster
 
Posts: 4
Default Create task request from Excel: reminder problem

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
  #2  
Old January 14th 08, 05:26 PM posted to microsoft.public.outlook.program_vba
JP[_3_]
external usenet poster
 
Posts: 201
Default Create task request from Excel: reminder problem

It appears that the "reminder" feature turns off when you assign the
task. You are no longer the owner so the "new" owner would need to set
a reminder. Even if you added it manually, it would get wiped out
when the delegate updates the status of the assigned task. Maybe a
followup email reminding them to complete the task?

I found a site with more information:
http://www.windowsitpro.com/Windows/...437/38437.html

ps- there are some errors in your code, if you need help fixing please
let me know.


HTH,
JP


On Jan 14, 5:01*am, Gauthier
wrote:
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


  #3  
Old January 14th 08, 09:01 PM posted to microsoft.public.outlook.program_vba
JP[_3_]
external usenet poster
 
Posts: 201
Default Create task request from Excel: reminder problem

Or you could just add it to the .Subject or .Body of the task :-)

--JP

On Jan 14, 11:26*am, JP wrote:
It appears that the "reminder" feature turns off when you assign the
task. You are no longer the owner so the "new" owner would need to set
a reminder. Even if you *added it manually, it would get wiped out
when the delegate updates the status of the assigned task. Maybe a
followup email reminding them to complete the task?

  #4  
Old January 15th 08, 11:09 AM posted to microsoft.public.outlook.program_vba
Gauthier
external usenet poster
 
Posts: 4
Default Create task request from Excel: reminder problem

Thanks a lot for the explanation. As the main (if not the only) purpose of
this code is to create a reminder which will pop up at the right time to
catch user attention, I will then try with a meeting request.

ps- there are some errors in your code, if you need help fixing please let me know.

If you spot something, suggestion is always welcome :-)
  #5  
Old January 15th 08, 03:35 PM posted to microsoft.public.outlook.program_vba
JP[_3_]
external usenet poster
 
Posts: 201
Default Create task request from Excel: reminder problem

A few things.

1. "Dim StartingRow, RequestCount As Integer" - in VBA, this
translates to "Dim StartingRow As Variant, RequestCount As Integer"

If you are trying to declare both variables as integers, try "Dim
StartingRow As Integer, RequestCount As Integer". The same goes for
"Dim ExtractedAsset, ExtractedUser As String" I think you meant "Dim
ExtractedAsset As String, ExtractedUser As String"

In other words you can share the "Dim", but not the declaration part.

2. "Set myOlApp = CreateObject("Outlook.Application")"

You might want to check if you are already running Outlook, then you
can substitute this code to use the existing instance instead of
always starting a new one:

On Error Resume Next
Set myOlApp = GetObject(, "Outlook.Application")
If Err.Number 0 Then
Set myOlApp = CreateObject("Outlook.Application")
End If
On Error GoTo 0

If myOlApp Is Nothing Then
MsgBox "Could not start Outlook!"
Exit Sub
End If

Or, since you have a reference to the Outlook object library, "Set
myOlApp = New Outlook.Application". CreateObject & GetObject are
really for late-bound code. That being said, I use it all the time.

3. "StartingRow = Selection.Row"

You can eliminate this part of your code and fix the rest so that you
could run it in a loop on multiple rows. For example here is the
cleaned up code.

Sub SendBackupTaskToCustomer()
Dim StartingRow As Integer, RequestCount As Integer
Dim ExtractedDate As Date
Dim ExtractedAsset As String, 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 " & ActiveSheet.UsedRange.Rows.count
- 1 & " customers?", vbOKCancel) = vbCancel Then Exit Sub

Set myOlApp = New Outlook.Application

For RequestCount = 2 To ActiveSheet.UsedRange.Rows.count
Set myOlTask = myOlApp.CreateItem(olTaskItem)
ExtractedDate = Worksheets("Sheet1").Cells(RequestCount, 1).Value
ExtractedAsset = Worksheets("Sheet1").Cells(RequestCount, 2).Value
ExtractedUser = Worksheets("Sheet1").Cells(RequestCount, 4).Value

If ExtractedUser = "" Or ExtractedAsset = "" Then
MsgBox ("Selection empty at row " & RequestCount & ". Process
stopped")
GoTo ExitProc
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"

.Recipients.Add (ExtractedUser)
.Assign
.DueDate = ExtractedDate - 1
.Importance = olImportanceHigh
'.ReminderSet = True
'.ReminderTime = ExtractedDate - 2
'.ReminderPlaySound = True
'.ReminderSoundFile = "C:\Windows\Media\Ding.wav"
'.Display
.Send
End With
Next RequestCount

ExitProc:
Set myOlTask = Nothing
Set myOlApp = Nothing

End Sub

Now you can create a spreadsheet with your headers in row 1, and
starting in row 2 you can list as many task recipients as you want and
the macro will create an assigned task for each.

HTH,
JP




On Jan 15, 5:09*am, Gauthier
wrote:
Thanks a lot for the explanation. As the main (if not the only) purpose of
this code is to create a reminder which will pop up at the right time to
catch user attention, I will then try with a meeting request.

ps- there are some errors in your code, if you need help fixing please let me know.


If you spot something, suggestion is always welcome :-)


  #6  
Old January 25th 08, 02:20 PM posted to microsoft.public.outlook.program_vba
Gauthier
external usenet poster
 
Posts: 4
Default Create task request from Excel: reminder problem

Thanks a lot JP for these helpfull information, you pointed some errors I was
doing from a long long time, I guess I will have to review many of my VBA
modules now. ;-)
 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Meeting request set reminder by itself sunec Outlook - Calandaring 2 August 17th 07 12:32 PM
Differentiate between Task and Task Request in NewInspector event Piyush Gupta Add-ins for Outlook 8 February 7th 07 10:01 PM
Differentiate between Task and Task Request in NewInspector event Piyush Gupta Outlook and VBA 1 February 7th 07 07:00 PM
Problem with Outlook Task Reminder-Parameter Values are not valid MarkW Outlook - General Queries 2 July 24th 06 06:39 PM
I create a new Task, but it won't let me set a reminder. Tasker Outlook - Calandaring 1 March 23rd 06 06:10 PM


All times are GMT +1. The time now is 12:56 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.