I can't seem to assign a value to Duration field in MSProject by using VBA

%3CLINGO-SUB%20id%3D%22lingo-sub-2711732%22%20slang%3D%22en-US%22%3EI%20can't%20seem%20to%20assign%20a%20value%20to%20Duration%20field%20in%20MSProject%20by%20using%20VBA%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2711732%22%20slang%3D%22en-US%22%3E%3CDIV%20class%3D%22votecell%20post-layout--left%22%3E%3CDIV%20class%3D%22js-voting-container%20d-flex%20jc-center%20fd-column%20ai-stretch%20gs4%20fc-black-200%22%3E%3CDIV%20class%3D%22js-vote-count%20flex--item%20d-flex%20fd-column%20ai-center%20fc-black-500%20fs-title%22%3E%3CSPAN%3EI%20can't%20seem%20to%20assign%20a%20value%20to%20Duration%20field%20in%20MSProject%20by%20using%20VBA.%20Probably%20has%20something%20to%20do%20with%20types%3F%20Tsk.Duration%20%3D%20(rate1)%20--while%20rate%201%20is%20defined%20as%20long%20and%20equals%2014%3C%2FSPAN%3E%3C%2FDIV%3E%3C%2FDIV%3E%3C%2FDIV%3E%3CDIV%20class%3D%22postcell%20post-layout--right%22%3E%3CDIV%20class%3D%22s-prose%20js-post-body%22%3E%3CP%3Ethe%20value%20that%20appears%20is%200.03%20(in%20days).%20Why%20not%2014%20days%3F%3F%3F%20Tsk.Duration%20is%20Variant%2FLong%3C%2FP%3E%3CP%3EThanks%20in%20advance%2C!%3C%2FP%3E%3C%2FDIV%3E%3C%2FDIV%3E%3C%2FLINGO-BODY%3E
Occasional Visitor
I can't seem to assign a value to Duration field in MSProject by using VBA. Probably has something to do with types? Tsk.Duration = (rate1) --while rate 1 is defined as long and equals 14

the value that appears is 0.03 (in days). Why not 14 days??? Tsk.Duration is Variant/Long

Thanks in advance,!

1 Reply
sivanr,
Because all time related values in Project are in minutes so when you have a value of 14, it is treated as 14 minutes which is 0.03 days, based on the Standard calendar and the definition for a day (i.e. 480 minutes)
Hope this helps
John