VB.Net and Project 2000 problems

B

Bradford Ray

Hi,

I am creating an .mpp file in VB.Net using the MS Project Object Model. All
is good except for a couple of annoying things I can't sort out:

a) the sub OutlineIndent doesn't take any parameters, but when I try and
run it it complains about invalid arguments?
b) to avoid a), I tried setting the IndentLevel but anything other than
"1" fails. (PS. I tried a) and b) on the 2nd task, theoretically forcing the
1st one to become a summary task)
c) the Critical field is readonly?? Why, and can I get around it?
d) some tasks start and end dates are not the same as the ones I
originally set them as. eg: I ended up with a milestone that started on the
25th and ended on the 26th?

Of course, any help would be greatly appreciated!

Cheers,
Brad.
 
J

JackD

I don't have time to debug a and b, but here are the answers for c and d

c) Critical is calculated. Any task that has the specified amount of total
slack is critical. You can set the options for what is defined as critical
by using OptionsCalculation CriticalSlack.
For example this sets it so any task that has zero slack is critical.
OptionsCalculation CriticalSlack:=0
The only way to change the amount of slack is to reorganize the schedule or
impose a constraint. I suggest that you take a course on the use of Project
so that you will understand how it works. Without an understanding of the
basic calculations and operations you will be a very frustrated coder. It is
not always intuitive or obvious.

d) If the milestone task has a duration of more than zero days it is
entirely possible that it will stretch over two days. It could be two
minutes long and take place in the last minute of the first day and the
first minute of the following day. If you are working with dates in project
you should always be careful to specify the time of day as well. If you want
the date to behave in a predictable manner make sure that it includes a time
which is defined as working time in project. If you don't do this it may
move to the next day or over the weekend.

Some hints for a and b. Try using task.outlinelevel to change the level of
the task.
 
R

Rod Gill

Hi, for a and b, what code did you use? I simply added two tasks to a new
file, selected the second then executed:

application.OutlineIndent

in the immediate window and the second task indented with no fuss. Try
recording a macro in Project of you doing manually what you want and then
copy and if necessary edit the code to your VB code.

--
For VBA posts, please use the public.project.developer group.
For any version of Project use public.project
For any version of Project Server use public. project.server

Rod Gill
Project MVP
For Microsoft Project companion projects, best practices and Project VBA
development services
visit www.project-systems.co.nz/
Email rodg AT project-systems DOT co DOT nz
 

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