M
meg99
using 2007. I have a macro that finds a task coded "C" and then adds
a task under it. The code is below. The problem is that after the
first pass it does not select the proper row. Anybody know what I
need to do?
Sub AddTask()
Dim TskRow as Integer, TskRowC As Integer
Dim EACTvalue As String
Dim Tsk As Task
SelectTaskColumn Column:="Name"
For Each Tsk In ActiveSelection.Tasks
TskRow = Tsk.ID
EACTvalue = Tsk.Text4
If EACTvalue = "" Then
Exit Sub
End If
If EACTvalue = "C" Then
TskRowC = TskRow
'==first time thru the next command works fine - selects
the proper row
'==and inserts a new task etc
'==2nd time thru it selects and then inserts 14 rows down
SelectTaskField Row:=TskRowC, Column:="Name"
EditInsert
SelectTaskField Row:=-1, Column:="Name", Width:=5,
Height:=1
FillDown
SetTaskField Field:="Text4", Value:="T"
End If
Next
End Sub
meg99
a task under it. The code is below. The problem is that after the
first pass it does not select the proper row. Anybody know what I
need to do?
Sub AddTask()
Dim TskRow as Integer, TskRowC As Integer
Dim EACTvalue As String
Dim Tsk As Task
SelectTaskColumn Column:="Name"
For Each Tsk In ActiveSelection.Tasks
TskRow = Tsk.ID
EACTvalue = Tsk.Text4
If EACTvalue = "" Then
Exit Sub
End If
If EACTvalue = "C" Then
TskRowC = TskRow
'==first time thru the next command works fine - selects
the proper row
'==and inserts a new task etc
'==2nd time thru it selects and then inserts 14 rows down
SelectTaskField Row:=TskRowC, Column:="Name"
EditInsert
SelectTaskField Row:=-1, Column:="Name", Width:=5,
Height:=1
FillDown
SetTaskField Field:="Text4", Value:="T"
End If
Next
End Sub
meg99