+ Reply to Thread
Results 1 to 13 of 13

Send Task to Outlook from Excel

Hybrid View

  1. #1
    Registered User
    Join Date
    07-23-2009
    Location
    USA
    MS-Off Ver
    Excel 2003
    Posts
    34

    Re: Send Task to Outlook from Excel

    DonkeyOte,

    Per the code below;

    Sub Example()
    Dim OLApp As Outlook.Application
    Dim OLTk As Outlook.TaskItem
    Set OLApp = New Outlook.Application
    Set OLTk = OLApp.CreateItem(olTaskItem)
    With OLTk
    .Subject = Cells(1, "A")
    .StartDate = Cells(2, "A")
    .DueDate = Cells(2, "A") + 1
    .ReminderTime = .StartDate - 1
    .Body = "This is a Task"
    .Save
    End With
    Set OLTk = Nothing
    Set OLApp = Nothing
    End Sub

    It always stops at the -Dim OLApp As Outlook.Application. It works in the workbook that I first pasted it in but when I try to paste it into another workbook it errors out at that line.

    Sure could use the help to get this solved.

    Thanks

  2. #2
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Send Task to Outlook from Excel

    First, please adhere to Forum Rules and add CODE tags to your last post:

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Highlight your code and click the # at the top of your post window. For more information about these and other tags, found here


    Second, as mentioned previously, check that you have referenced the Outlook Object Library in the file that's failing - VBE - Tools - References ... Microsoft Outlook Library - version will vary pending Office version (12.0 for 2007, 11.0 for 2003 etc...)

  3. #3
    Registered User
    Join Date
    07-23-2009
    Location
    USA
    MS-Off Ver
    Excel 2003
    Posts
    34

    Re: Send Task to Outlook from Excel

    Sorry about that.

    Not trying to break rules.

    Let me figure that out and post my information again.

    Thanks for the advice.

    All,

    Please accept my apologies.

  4. #4
    Forum Contributor
    Join Date
    01-21-2005
    Location
    Colorado
    MS-Off Ver
    2000,2003,2007
    Posts
    481

    Re: Send Task to Outlook from Excel

    I realize this is an old thread but hopefully someone will see this post and have a solution.

    I am using the above code to create a task automatically and it works great.

    Where I'm having trouble is setting the 'Priority' or Importance of the task.

    I can see the Importance property of the task once I make it but think I am getting the syntax wrong to set the importance to either Low, Normal or High.

    Any suggestions would be appreciated.

    Thank you

  5. #5
    Forum Contributor
    Join Date
    01-21-2005
    Location
    Colorado
    MS-Off Ver
    2000,2003,2007
    Posts
    481

    Re: Send Task to Outlook from Excel

    Answered my own question:
    when setting the importance I was trying to set the value to task.importance = olImportanceHigh (or olImportanceLow or olImportnaceNormal) which wasn't working.

    If I set the task.importance = 0 (zero for Low, 1 for Normal, 2 for High) it works perfectly.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1