Argument Invalid?

S

SonT

Hello,

I have used the macro below to import data from one schedule to another
without any problem. However, whenever I try to import the data into a
published
schedule, I always get an invalid message. It only occurred whenever I tried
to
update the following fields: Start, Finish, Actual Start, and Actual Finish.
Please let me know what the problems may be and how I may resolved it.

Sub CorrectItx()
Dim a As Project
Dim b As Project

Dim t As Task
Dim x As Task

Set a = Application.ActiveProject
FileOpen ("C:\Documents\test1.mpp")
Set b = Application.ActiveProject

For Each t In a.Tasks
If Not t Is Nothing Then
For Each x In b.Tasks
If Not t Is Nothing Then
If (t.UniqueID = x.UniqueID) Then x.Start = t.Start

End If

Next x
End If
Next t
End Sub

Thank you in advance.
 
S

SonT

I am trying to update the start and finish of every tasks in the Project
Server schedule.
 
J

Jim Aksel

As Scudder implied --- you can't update dates on summary level tasks. The
way I read your response "every task" includes summary tasks too... sorry,
the Gods will not like that.

Add one more test in your if nest:

if t.summary=false and x.summary = false then allow the update to continue
--
If this post was helpful, please consider rating it.

Jim

Visit http://project.mvps.org/ for FAQs and more information
about Microsoft Project
 
J

Jim Aksel

Another thought --- You also want to exclude external tasks (if you have
external predecessors)
t.External and x.External have to be false as well
--
If this post was helpful, please consider rating it.

Jim

Visit http://project.mvps.org/ for FAQs and more information
about Microsoft Project
 
S

Scudder

Apologies for my earlier 'cryptic' reply.

I wrote a lengthier response complete with the a more crash aversive code
fragment - when I clicked post I got "Page not found error".

Back page wiped my response - 1 for my lessons learned file methinks.

Positive proof that no good deed goes unpunished.

Cheers, Lee.
 
S

SonT

Thanks, Jim. The test was successful.

Jim Aksel said:
As Scudder implied --- you can't update dates on summary level tasks. The
way I read your response "every task" includes summary tasks too... sorry,
the Gods will not like that.

Add one more test in your if nest:

if t.summary=false and x.summary = false then allow the update to continue
--
If this post was helpful, please consider rating it.

Jim

Visit http://project.mvps.org/ for FAQs and more information
about Microsoft Project
 
S

SonT

I expanded the codes below to import the following fields from my contractor
schedule into my published Project Server schedule:

Duration
Start
Finish
Predecessors
Successors
Calendar
% Complete
Actual Start
Actual Finish
Actual Duration
Remaining Duration
Constraints

Once imported, I noticed that the duration of each in progress task in the
project server schedule is always slightly off (usually less than 1.5 days)
from the contractor schedule. The contractor did resource loaded the
schedule. The assignment unit seems to be the same. Any recommendation is
appreciated.

Thank you in advance.
 

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