add task

C

charles14

I have a long process that brings in information from Oracle then converts it
into the correct format and compares to see if it is a new task, existing
task with deadline change or completed tasks.

I looked through the code on this site and got have got the tasks.add down.
All the right fields get updated.

My problem is the next time I find a new task to add and do the "tasks.add
(name)" all of the information writes over the information I previously added
so instead of adding 50 activities, only one is added and has all the
information of the 50th addition.

This is probably easy for you guys but I have spent hours trying to no
avail, Help, please.
 
R

Rod Gill

Your code is setting T to the active cell, adding a new name, but always
editing the active cell. Try:
Dim Proj As Project
Dim Tsk As Task
Dim sName As String

Set Tsk = Proj.Tasks.Add (sName)
Tsk.Deadline = "01/01/2007"

Will work as Tsk always points to the last task added. You don't even need
the selectend because Tsk is always made equal to the new task without ever
having to select it. This will also run faster!


--

Rod Gill
Project MVP

NEW!! Project VBA Book, for details visit: http://www.projectvbabook.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top