Where do I find the start and finish of the split tasks?

M

Monica

In searching for an answer in this forum, I came across the code below.
Whenever I print out my to-do list, it only shows the original start date and
final finish date of a task. I'd like to see the interim start and end dates
of the split tasks.

Could this code be modified to do what I need?

Sub splits()
For Each Task In ActiveProject.Tasks
If Task.SplitParts.Count > 1 Then
For Each SplitPart In Task.SplitParts
If SplitPart.Finish >= Date And SplitPart.Start <= Date Then
MsgBox Task.Name & " is currently running"
End If
Next SplitPart
End If
Next Task
End Sub

Monica
 
J

JLB

Try this (I'm not a VBA guru)

Sub splits()
Dim j As Integer
For Each Task In ActiveProject.Tasks
If Task.SplitParts.Count > 1 Then
j = 0
For Each SplitPart In Task.SplitParts
j = j + 1
Debug.Print "Start ";
ActiveProject.Tasks(Task.ID).SplitParts(j).Start; " "; "Finish ";
ActiveProject.Tasks(Task.ID).SplitParts(j).Finish; " "
Next SplitPart
End If
Next Task
End Sub
 
M

Monica

When I attempt to run it, I get the following message box: "Compile error:
Syntax error"

After I hit "ok" there is a yellow arrow pointing to "Sub splits()" and the
line is highlighted yellow as well.

Line 9 and Line 10 are red. Above the code, I see "Ln 9, Col 6" so maybe
that's where the error lies?
 
J

JackD

Looks like a line wrap problem on the debug print statement.
Try this:

Sub splits()
Dim j As Integer
For Each Task In ActiveProject.Tasks
If Task.SplitParts.Count > 1 Then
j = 0
For Each SplitPart In Task.SplitParts
j = j + 1
Debug.Print "Start "; _
ActiveProject.Tasks(Task.ID).SplitParts(j).Start; _
" "; "Finish "; _
ActiveProject.Tasks(Task.ID).SplitParts(j).Finish; " "
Next SplitPart
End If
Next Task
End Sub

It is exactly the same but with the debug.print line broken into bitesize
pieces using the continuation character _
 
M

Monica

I didn't receive any errors (yay!) but I don't see where any of the output
has changed. Should I be looking somewhere specific?

For example, I still see the following:

Fri, Nov 19th
Replace Tile Roof Start: 11/19 Finish: 11/21

Sat, Nov 20th
Replace Tile Roof Start: 11/19 Finish: 11/21

Sun, Nove 21st
Replace Tile Roof Start: 11/19 Finish: 11/21

How do resources know when to stop and start or how much time to allocate to
a specific task on a specific day, especially when they have multiple split
tasks occurring on the same day?
 
M

Monica

Sub splits()
Dim j As Integer
For Each Task In ActiveProject.Tasks
If Task.SplitParts.Count > 1 Then
j = 0
For Each SplitPart In Task.SplitParts
j = j + 1
Debug.Print "Start "; _
ActiveProject.Tasks(Task.ID).SplitParts(j).Start; _
" "; "Finish "; _
ActiveProject.Tasks(Task.ID).SplitParts(j).Finish; " "
Next SplitPart
End If
Next Task
End Sub
 
J

JLB

That code (it's the code I provided in an earlier message) does not generate
the display you say doesn't work.

Your example display, shown below, includes the task name but the code you
just posted does not reference it.

Please post the code that generates the display you show below.
 
M

Monica

Ah, sorry, I misunderstood you. I was just using the information as an
example. It's a simplified example of part of the information displayed in
the to-do list report I print out (which is essentially the task name, start,
finish, resource initials, and duration). But, let me revise the example to
clarify...

For one resource, I might get:

Fri, Nov 19th
Replace Tile Roof Start: 11/19 Finish: 11/29
Sat, Nov 23th
Replace Tile Roof Start: 11/19 Finish: 11/29
Lay Sod Start: 11/23 Finish: 11/30
Sun, Nov 29th
Replace Tile Roof Start: 11/19 Finish: 11/29
Lay Sod Start: 11/23 Finish: 11/30
Mon, Nov 30th
Lay Sod Start: 11/23 Finish: 11/30

But, what I want to see is:

Fri, Nov 19th
Replace Tile Roof Start: 11/19 Finish: 11/19
Sat, Nov 23th
Replace Tile Roof Start: 11/23 Finish: 11/23
Lay Sod Start: 11/23 Finish: 11/23
Sun, Nov 29th
Replace Tile Roof Start: 11/29 Finish: 11/29
Lay Sod Start: 11/29 Finish: 11/29
Mon, Nov 30th
Lay Sod Start: 11/30 Finish: 11/30

I've posted in general forum and it was suggested that the way to go about
this was vba.
 
J

JackD

The code will not affect the report. You will have to write code to create
your own report.
Another option is to not use splits and enter each of the splits as an
individual task. That is what I would do.
Splitting tasks is not the best idea for what you are trying to do.
 
M

Monica

Who could write this code? Could I pay someone?

JackD said:
The code will not affect the report. You will have to write code to create
your own report.
Another option is to not use splits and enter each of the splits as an
individual task. That is what I would do.
Splitting tasks is not the best idea for what you are trying to do.

--
-Jack ... For project information and macro examples visit
http://masamiki.com/project

..
 
J

JackD

Probably.
There are some people who read this newsgroup who would likely be able to
and who will give you an idea of how much it would cost.

If you are going to do that I think you should start a new thread instead of
using this one.
 
M

Monica

Does the above code do anything at all?

JackD said:
Probably.
There are some people who read this newsgroup who would likely be able to
and who will give you an idea of how much it would cost.

If you are going to do that I think you should start a new thread instead of
using this one.

--
-Jack ... For project information and macro examples visit
http://masamiki.com/project

..
 
J

JackD

Yes it does. It displays the split information in the immediate window in
the visual basic editing environment. This code pops up a box with the
information. Use it only on a small project otherwise you will be clicking
"OK" forever.

Sub splits()
Dim j As Integer
For Each Task In ActiveProject.Tasks
If Task.SplitParts.Count > 1 Then
j = 0
For Each SplitPart In Task.SplitParts
j = j + 1
Msgbox "Start "& _
ActiveProject.Tasks(Task.ID).SplitParts(j).Start & _
" Finish " & _
ActiveProject.Tasks(Task.ID).SplitParts(j).Finish & VBCrlf
Next SplitPart
End If
Next Task
End Sub
 

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