Tuesday, 6 August 2013

VBA - Compile error: Type mismatch in attached code

VBA - Compile error: Type mismatch in attached code

For VBA coding for MS-project,
I have been getting compilation error (compile error : type mismatch) in
below code. The type prompts correctly as Task and the Task t is present.
Similar code works at most other places.
Private Sub a()
Dim tChild As Task
For Each t In ActiveProject.OutlineChildren
Set tChild = t
'MsgBox (TypeName(tChild)) 'prompts with value "Task", as
expected
b (tChild) ' error here
Next t
End Sub
Sub b(t As Task)
End Sub
Thanks
Paddy

No comments:

Post a Comment