Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 69
Default Task option control

I have the following code that work somewhat okay when I create a new Task
record. Where I start running into problems is with the "With" Statement,
Specifically the
..Body = c.Offset(0, 2).Value
..DueDate = c.Offset(0, 5).Value
Options...

I am trying to get my code to pick specific information out of the row the
user starts the macro on to set up the task with limited interaction with the
user. If I change the above to
.Body = "Anything"
.DueDate = "3/25/08"
Everything works fine. But again this information is specific to my code and
does not allow for customized tasked based on user control.

Option Explicit
Sub CreateNewTask()

Dim olApp As Object
Dim olTsk As Object
Dim c As Range

Set olApp = CreateObject("outlook.application") ' New Outlook.Application
Set olTsk = olApp.CreateItem(3) ' OLTaskitem

With olTsk
.Subject = "Follow Up on Quote"
.Status = 1 ' olTaskInProgress
.Importance = 2 ' olImportanceHigh
.Body = c.Offset(0, 2).Value
.DueDate = c.Offset(0, 5).Value
.TotalWork = 40
.ActualWork = 20
.Display
.Save
End With

Set olTsk = Nothing
Set olApp = Nothing

End Sub

Can some one help and point me in the right direction.

Thanks
Peter W
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 284
Default Task option control

Peter,

It's been a while so I don't recall the specifics but I do remember that
task items can be a bit fussy about how they're fed dates, both for the
..DueDate and .StartDate. One thing I discovered was that if you create a
task item and leave a date field blank, the date #1/1/4501# is actually
entered but the user doesn't see anything in the data entry box.

Here is a piece of a subroutine I did that worked fine. My guess is that
you're getting the problem from the date lines and that grabbing cell
contents for the .body is probably OK.

_______________________________

If Len(Cells(R, 3).Value) 0 Then
If IsDate(Cells(R, 3).Value) Then
.DueDate = Cells(R, 3).Value
Else
.DueDate = #1/1/4501#
End If
Else
.DueDate = #1/1/4501#
End If

______________________________

Steve Yandl



"Looping through" wrote in
message ...
I have the following code that work somewhat okay when I create a new Task
record. Where I start running into problems is with the "With" Statement,
Specifically the
.Body = c.Offset(0, 2).Value
.DueDate = c.Offset(0, 5).Value
Options...

I am trying to get my code to pick specific information out of the row the
user starts the macro on to set up the task with limited interaction with
the
user. If I change the above to
.Body = "Anything"
.DueDate = "3/25/08"
Everything works fine. But again this information is specific to my code
and
does not allow for customized tasked based on user control.

Option Explicit
Sub CreateNewTask()

Dim olApp As Object
Dim olTsk As Object
Dim c As Range

Set olApp = CreateObject("outlook.application") ' New
Outlook.Application
Set olTsk = olApp.CreateItem(3) ' OLTaskitem

With olTsk
.Subject = "Follow Up on Quote"
.Status = 1 ' olTaskInProgress
.Importance = 2 ' olImportanceHigh
.Body = c.Offset(0, 2).Value
.DueDate = c.Offset(0, 5).Value
.TotalWork = 40
.ActualWork = 20
.Display
.Save
End With

Set olTsk = Nothing
Set olApp = Nothing

End Sub

Can some one help and point me in the right direction.

Thanks
Peter W



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 69
Default Task option control

Steve, thanks for the reply.

I am not sure this will work for what I am tring to do. I inserted you code
into my Macro and got "type mismatch errors and user field not defined errors"

Do you know of website or source for this subject?

"Steve Yandl" wrote:

Peter,

It's been a while so I don't recall the specifics but I do remember that
task items can be a bit fussy about how they're fed dates, both for the
..DueDate and .StartDate. One thing I discovered was that if you create a
task item and leave a date field blank, the date #1/1/4501# is actually
entered but the user doesn't see anything in the data entry box.

Here is a piece of a subroutine I did that worked fine. My guess is that
you're getting the problem from the date lines and that grabbing cell
contents for the .body is probably OK.

_______________________________

If Len(Cells(R, 3).Value) 0 Then
If IsDate(Cells(R, 3).Value) Then
.DueDate = Cells(R, 3).Value
Else
.DueDate = #1/1/4501#
End If
Else
.DueDate = #1/1/4501#
End If

______________________________

Steve Yandl



"Looping through" wrote in
message ...
I have the following code that work somewhat okay when I create a new Task
record. Where I start running into problems is with the "With" Statement,
Specifically the
.Body = c.Offset(0, 2).Value
.DueDate = c.Offset(0, 5).Value
Options...

I am trying to get my code to pick specific information out of the row the
user starts the macro on to set up the task with limited interaction with
the
user. If I change the above to
.Body = "Anything"
.DueDate = "3/25/08"
Everything works fine. But again this information is specific to my code
and
does not allow for customized tasked based on user control.

Option Explicit
Sub CreateNewTask()

Dim olApp As Object
Dim olTsk As Object
Dim c As Range

Set olApp = CreateObject("outlook.application") ' New
Outlook.Application
Set olTsk = olApp.CreateItem(3) ' OLTaskitem

With olTsk
.Subject = "Follow Up on Quote"
.Status = 1 ' olTaskInProgress
.Importance = 2 ' olImportanceHigh
.Body = c.Offset(0, 2).Value
.DueDate = c.Offset(0, 5).Value
.TotalWork = 40
.ActualWork = 20
.Display
.Save
End With

Set olTsk = Nothing
Set olApp = Nothing

End Sub

Can some one help and point me in the right direction.

Thanks
Peter W




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 284
Default Task option control

Peter,

Where I have
Cells(R, 3).Value
did you substitute
c.Offset(0, 5).Value
?

Most of the website information you will find involves working with messages
or contacts. I was helping someone do a workbook that would allow him to
synchronize a list of tasks in a workbook with his task folder in Outlook
and found I had to do much of stuff by trial and error (that doesn't mean
there are not decent websites, I just didn't find any).

Steve


"Looping through" wrote in
message ...
Steve, thanks for the reply.

I am not sure this will work for what I am tring to do. I inserted you
code
into my Macro and got "type mismatch errors and user field not defined
errors"

Do you know of website or source for this subject?

"Steve Yandl" wrote:

Peter,

It's been a while so I don't recall the specifics but I do remember that
task items can be a bit fussy about how they're fed dates, both for the
..DueDate and .StartDate. One thing I discovered was that if you create
a
task item and leave a date field blank, the date #1/1/4501# is actually
entered but the user doesn't see anything in the data entry box.

Here is a piece of a subroutine I did that worked fine. My guess is that
you're getting the problem from the date lines and that grabbing cell
contents for the .body is probably OK.

_______________________________

If Len(Cells(R, 3).Value) 0 Then
If IsDate(Cells(R, 3).Value) Then
.DueDate = Cells(R, 3).Value
Else
.DueDate = #1/1/4501#
End If
Else
.DueDate = #1/1/4501#
End If

______________________________

Steve Yandl



"Looping through" wrote in
message ...
I have the following code that work somewhat okay when I create a new
Task
record. Where I start running into problems is with the "With"
Statement,
Specifically the
.Body = c.Offset(0, 2).Value
.DueDate = c.Offset(0, 5).Value
Options...

I am trying to get my code to pick specific information out of the row
the
user starts the macro on to set up the task with limited interaction
with
the
user. If I change the above to
.Body = "Anything"
.DueDate = "3/25/08"
Everything works fine. But again this information is specific to my
code
and
does not allow for customized tasked based on user control.

Option Explicit
Sub CreateNewTask()

Dim olApp As Object
Dim olTsk As Object
Dim c As Range

Set olApp = CreateObject("outlook.application") ' New
Outlook.Application
Set olTsk = olApp.CreateItem(3) ' OLTaskitem

With olTsk
.Subject = "Follow Up on Quote"
.Status = 1 ' olTaskInProgress
.Importance = 2 ' olImportanceHigh
.Body = c.Offset(0, 2).Value
.DueDate = c.Offset(0, 5).Value
.TotalWork = 40
.ActualWork = 20
.Display
.Save
End With

Set olTsk = Nothing
Set olApp = Nothing

End Sub

Can some one help and point me in the right direction.

Thanks
Peter W






Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
where will i get task pane option in Excel Guru Excel Discussion (Misc queries) 2 January 21st 08 03:38 PM
Setting an option control Patrick Simonds Excel Programming 1 April 4th 06 03:25 AM
Control Box Option Buttons jlarkin Excel Programming 4 April 23rd 04 12:31 AM
Option button task D. Miller Excel Programming 3 January 22nd 04 05:57 AM
Option Button Control Rod[_4_] Excel Programming 0 September 16th 03 11:30 PM


All times are GMT +1. The time now is 07:33 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"