Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
where will i get task pane option in Excel | Excel Discussion (Misc queries) | |||
Setting an option control | Excel Programming | |||
Control Box Option Buttons | Excel Programming | |||
Option button task | Excel Programming | |||
Option Button Control | Excel Programming |