![membuat project vb net 2010 membuat project vb net 2010](https://i.ytimg.com/vi/gu5Ec4qs0XQ/maxresdefault.jpg)
I changed a few things: 1) rather than hard-coding the start field, use a task relationship to keep it with it's task when the task moves 2) since zero-duration tasks have no work, it is not necessary to add resources. NewTask.ResourceNames = myTask.ResourceNamesĪpplication.GanttBarFormat GanttStyle:=3, StartShape:=13, StartType:=0, StartColor:=255, MiddleShape:=0, MiddlePattern:=0, MiddleColor:=255, EndShape:=0, EndColor:=255, EndType:=0Īpplication.SelectTaskField Row:=0, Column:="Name" Set newTask = (myTask.Name & " - Milestone", myTask.ID + 1) Application.ScreenUpdating = FalseĬolTasks.Add myTask, CStr(myTask.UniqueID) I'm posting the solution in VBA since that is likely to be the most relevant to other viewers I can post a vb.net version if needed. net) of selected tasks and then looping through those. The problem with the extra task can be solved by storing a collection (or list in. Is there a better way to create and assign values to new tasks?
![membuat project vb net 2010 membuat project vb net 2010](http://nguprek.com/wp-content/uploads/2020/03/3.png)
#Membuat project vb net 2010 code#
I realise this bit of code is in VB.net but I can work with VBA too. It seems to go too far when looping through the selected tasks and creates 1 task too many, I worked around this by going back and deleting the extra task but it doesn't seem like the best solution to me. Proj = įor Each myTask In Īpplication.SelectTaskField(Row:=1, Column:="Name")Īpplication.SetTaskField(Field:="Duration", Value:="0")Īpplication.SetTaskField(Field:="Start", Value:=myTask.Finish)Īpplication.SetTaskField(Field:="Name", Value:=myTask.Name & " - Milestone")Īpplication.SetTaskField(Field:="Resource Names", Value:=myTask.ResourceNames)Īpplication.SetTaskField(Field:="Text3", Value:="Milestone")Īpplication.GanttBarFormat(GanttStyle:=3, StartShape:=13, StartType:=0, StartColor:=255, MiddleShape:=0, MiddlePattern:=0, MiddleColor:=255, EndShape:=0, EndColor:=255, EndType:=0)Īpplication.SelectTaskField(Row:=-1, Column:="Name") At the moment I have some code that creates new tasks, but it's really buggy and inconsistent.