+ Reply to Thread
Results 1 to 18 of 18

create/assign Outlook tasks from a range of cells

Hybrid View

  1. #1
    Registered User
    Join Date
    05-15-2008
    Posts
    9

    create/assign Outlook tasks from a range of cells

    I have had some help with this (thanks!) but am stuck.

    Can someone add to the code below and make it so that multiple tasks, with multiple assignees, can be created from a range of cells, such as:
    Column A Column B
    Row 1 Task Subject Assign to
    Row 2 GV LP for AZ John Brown
    Row 3 GV LP for CO John Brown
    Row 4 GV LP for IL Suzy Smith
    Row 5 GV LP for IN Suzy Smith
    Row 6 GV LP for KY Suzy Smith
    Row 7 GV LP for MN Suzy Smith
    Row 8 GV LP for MS Bob Barker
    Row 9 GV LP for NC Bob Barker
    Row 10 GV LP for NJ Bob Barker
    Row 11 GV LP for NM Bob Barker
    Row 12 GV LP for NV Bob Barker
    Row 13 GV LP for NY Bob Barker
    Row 14 GV LP for OH Bob Barker
    Row 15 GV LP for SC Bob Barker
    Row 16 GV LP for WV Bob Barker
    (Sorry, it didn't translate well. The "GV LP for AZ" is cell A2, "John Brown" is cell B2.)

    Here is the code I have so far:
    Sub CreateTask()
    Const olTaskItem = 3
    Dim oOlookApp As Object
    Dim oOlookTask As Object
    Dim rng As Range
        Set oOlookApp = CreateObject("Outlook.Application")
        
        Set rng = Range("A1")
        
        While rng.Value <> ""
            Set oOlookTask = oOlookApp.CreateItem(olTaskItem)
               
            With oOlookTask
                .Subject = rng.Value
                .Save
            End With
            Set rng = rng.Offset(1)
            
        Wend
    End Sub
    This creates the tasks but assigns them to me.

    Can anyone help?

    I would also like to have a due date column, but it is not absolutely necessary.

    Thanks!

    David
    Last edited by royUK; 05-16-2008 at 11:23 AM.

  2. #2
    Registered User
    Join Date
    01-07-2008
    Location
    Northampton, UK
    MS-Off Ver
    version 2212, office 365 enterprise
    Posts
    74
    I would wrap your code if I were you before you get told off

  3. #3
    Valued Forum Contributor mudraker's Avatar
    Join Date
    11-10-2003
    Location
    Melbourne, Australia
    Posts
    3,983
    dftf

    Welcome to Exceltip forum

    Please take a couple of minutes and read the Forum Rules then wrap your VBA code (Rule 3)

    chrismann85

    Thanks for trying to warn dftf
    Please Read Forum Rules Before Posting
    Wrap VBA code by selecting the code and clicking the # icon or Read This
    How To Cross Post politely

    Top Excel links for beginners to Experts

    If you are pleased with a member's answer then use the Scales icon to rate it
    If my reply has assisted or failed to assist you I welcome your Feedback.

  4. #4
    Registered User
    Join Date
    05-15-2008
    Posts
    9
    Thanks for the polite warnings. I am new to this stuff.

    I can't find an edit button so I am reposting, hopefully in the correct manner.

    Sub CreateTask()
    Const olTaskItem = 3
    Dim oOlookApp As Object
    Dim oOlookTask As Object
    Dim rng As Range
    Set oOlookApp = CreateObject("Outlook.Application")
    
    Set rng = Range("A1")
    
    While rng.Value <> ""
    Set oOlookTask = oOlookApp.CreateItem(olTaskItem)
    
    With oOlookTask
    .Subject = rng.Value
    .Save
    End With
    Set rng = rng.Offset(1)
    
    Wend
    End Sub
    I also read that I should attach a file so others can test the data without retyping. The file is named "template.xls".

    Can anyone help?

    Thank you!

    David
    Attached Files Attached Files
    Last edited by dftf; 05-16-2008 at 11:55 AM.

  5. #5
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    Attach your file by replying to this thread, scroll down the page & click the Edit button. It's best to zip the file first.
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  6. #6
    Registered User
    Join Date
    05-15-2008
    Posts
    9
    Thanks - zipped file attached.

+ 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