Event Code Question

  • Thread starter Mark Durrenberger
  • Start date
M

Mark Durrenberger

The code below handles a change in "Duration*" either from a user typing in
a value or when a value is typed in then a "Fill down" command is used (Fill
down uses a selection so the for each in the ActiveSelection handles this
nicely.)

How do I handle a "Paste" change? In otherwords, what if the user pastes in
a value or several values in the Duration8 Column? Paste does not seem to
work with an "ActiveCelection" collection. What does it work with?

Thanks, Mark


'Private Sub MSPApp_ProjectBeforeTaskChange(ByVal tsk As MSProject.Task, _
ByVal Field As PjField, _
ByVal NewVal As Variant, _
Cancel As Boolean)
'
' change in duration8
' works for either a typed change or a "fill" (selection)
'
Select Case Field
Case pjTaskDuration8
For Each T In ActiveSelection.Tasks
T.Duration = (T.Duration10 + T.Duration9 + T.Duration8) / 3
T.Estimated = False
Next T
TextDuration = NewVal ' to handle the byval/byref passing in the
next statement
NewDuration = myConvertTextDuration(TextDuration) ' looks for
day/week/minutes units
ActiveCell.Task.Duration = (ActiveCell.Task.Duration10 +
ActiveCell.Task.Duration9 + NewDuration) / 3
End Select

--
 

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