Quantcast
Channel: Project Customization and Programming forum
Viewing all articles
Browse latest Browse all 5347

Disable MS Project automatic changing of start and finish dates of a task based on hours of the task.(Macro)

$
0
0

Hello Gurus,

I am creating mpp files using data from a excel data. macro written in the excel file is used to create the mpp files.

below i have quoted sample code for ref.

Set pjApp = CreateObject("MSProject.Application")
pjApp.FileNew
Set newproj = pjApp.ActiveProject
......
......
newproj.Tasks.Add (task_name)
newproj.Tasks.(mpp_row_number).type = "2" ' value 2 for fixed work type
newproj.Tasks(mpp_row_number).Start = task_start_date
newproj.Tasks(mpp_row_number).Finish = task_end_date
newproj.Tasks(mpp_row_number).Hours = work_hours
newproj.Tasks(mpp_row_number).ResourceNames = resource_name
....
....
pjApp.FileSaveAs mpp_file_save_path & mpp_file_name & ".mpp"
pjApp.FileClose
pjApp.Quit

My problem is that, I am not getting the right start and finish date for a task in the generated mpp file. it is automatically changing either start or finish date based on the hours assigned to the task. If i am not assigning the hours of the task then it is working perfect. All my task are of type "fixed work"

my requirement is that, i have a start date, finish date and total hours for the task. resource has to work that much hours for the given start an finish date.

example

case 1. 

start: 01-Jan-2014 

end : 31-Jan-2014

Hours : 180 hours

Here the resource has work 180 hours from 01-Jan-2014 to 31-Jan-2014.

case 2. 

start: 01-Mar-2014 

end : 31-Mar-2014

Hours : 80 hours

Here the resource has work 80 only hours from 01-Mar-2014 to 31-Mar-2014.

Somebody please help to disable the automatic change of start and finish date of a task based on hours assigned. I am stuck up with the issue.

Any support is appreciated.


Viewing all articles
Browse latest Browse all 5347

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>