P
Pete Rooney
I'm trying to write some code to scan all my task names and expand outlines
if a task name matches a condition. This is fine until the scan hits a blank
task at which point I get an "Object Variable or with block variable not set"
message pointing to the If TaskName.name="Software Management" line
Please excuse the rough code - I've only been VBAing in Project for three
days.
Can anyone advise as to what I should do - if I take out all the blank tasks
in the project, the error doesn't occur, but I want to know why - I probabbly
need to get out more, too.
I also have a hideous feeling that I'm on the wrong board - I'm sure the one
I used on my colleaguie's PC was orange at the top of the screen, but I can't
find out where I was!
Cheers
Pete Rooney
Sub ASMFilter()
Dim TaskName As Task
Dim I As Integer
SelectTaskColumn Column:="Name"
OutlineShowTasks OutlineNumber:=pjTaskOutlineShowLevel9
OutlineShowTasks OutlineNumber:=pjTaskOutlineShowLevel3
For Each TaskName In ActiveSelection.Tasks
If TaskName.Name = "Software Management" Then
'MsgBox (TaskName & " " & TaskName.Name)
TaskName.OutlineShowSubTasks
End If
Next
End Sub
if a task name matches a condition. This is fine until the scan hits a blank
task at which point I get an "Object Variable or with block variable not set"
message pointing to the If TaskName.name="Software Management" line
Please excuse the rough code - I've only been VBAing in Project for three
days.
Can anyone advise as to what I should do - if I take out all the blank tasks
in the project, the error doesn't occur, but I want to know why - I probabbly
need to get out more, too.
I also have a hideous feeling that I'm on the wrong board - I'm sure the one
I used on my colleaguie's PC was orange at the top of the screen, but I can't
find out where I was!
Cheers
Pete Rooney
Sub ASMFilter()
Dim TaskName As Task
Dim I As Integer
SelectTaskColumn Column:="Name"
OutlineShowTasks OutlineNumber:=pjTaskOutlineShowLevel9
OutlineShowTasks OutlineNumber:=pjTaskOutlineShowLevel3
For Each TaskName In ActiveSelection.Tasks
If TaskName.Name = "Software Management" Then
'MsgBox (TaskName & " " & TaskName.Name)
TaskName.OutlineShowSubTasks
End If
Next
End Sub