Sub checkfields2() 'This macro will check and report out which custom task fields are used 'It requires Project 2002 and above as it relies on the GetField 'and FieldNameToFieldConstant methods which were not introduced until '2002. 'It does not include resource fields, however it is a simple matter to 'do it by replacing the pjTask constant with pjResource. 'Copyright Jack Dahlgren, Oct. 2004 Dim mycheck As Boolean Dim myType, usedfields As String Dim t As Task Dim ts As Tasks Dim i, it As Integer Set ts = ActiveProject.Tasks usedfields = "Custom Fields used in this file" & vbCrLf myType = "Text" usedfields = usedfields & vbCrLf & "--" & UCase(myType) & "--" & vbCrLf For i = 1 To 30 mycheck = False it = 0 While Not mycheck And (it < ts.Count) it = it + 1 If Not ts(it) Is Nothing Then If ts(it).GetField(FieldNameToFieldConstant(myType & i, pjtask)) <> "" Then usedfields = usedfields & myType & CStr(i) & vbCr mycheck = True End If End If Wend Next i myType = "Number" usedfields = usedfields & vbCrLf & "--" & UCase(myType) & "--" & vbCrLf For i = 1 To 20 mycheck = False it = 0 While Not mycheck And (it < ts.Count) it = it + 1 If Not ts(it) Is Nothing Then If ts(it).GetField(FieldNameToFieldConstant(myType & i, pjtask)) <> 0 Then usedfields = usedfields & myType & CStr(i) & vbCr mycheck = True End If End If Wend Next i myType = "Duration" usedfields = usedfields & vbCrLf & "--" & UCase(myType) & "--" & vbCrLf For i = 1 To 10 mycheck = False it = 0 While Not mycheck And (it < ts.Count) it = it + 1 If Not ts(it) Is Nothing Then If Left(ts(it).GetField(FieldNameToFieldConstant(myType & i, pjtask)), 2) <> "0 " Then usedfields = usedfields & myType & CStr(i) & vbCr mycheck = True End If End If Wend Next i myType = "Cost" usedfields = usedfields & vbCrLf & "--" & UCase(myType) & "--" & vbCrLf For i = 1 To 10 mycheck = False it = 0 While Not mycheck And (it < ts.Count) it = it + 1 If Not ts(it) Is Nothing Then If ts(it).GetField(FieldNameToFieldConstant(myType & i, pjtask)) <> 0 Then usedfields = usedfields & myType & CStr(i) & vbCr mycheck = True End If End If Wend Next i myType = "Start" usedfields = usedfields & vbCrLf & "--" & UCase(myType) & "--" & vbCrLf For i = 1 To 10 mycheck = False it = 0 While Not mycheck And (it < ts.Count) it = it + 1 If Not ts(it) Is Nothing Then If ts(it).GetField(FieldNameToFieldConstant(myType & i, pjtask)) <> "NA" Then usedfields = usedfields & myType & CStr(i) & vbCr mycheck = True End If End If Wend Next i myType = "Finish" usedfields = usedfields & vbCrLf & "--" & UCase(myType) & "--" & vbCrLf For i = 1 To 10 mycheck = False it = 0 While Not mycheck And (it < ts.Count) it = it + 1 If Not ts(it) Is Nothing Then If ts(it).GetField(FieldNameToFieldConstant(myType & i, pjtask)) <> "NA" Then usedfields = usedfields & myType & CStr(i) & vbCr mycheck = True End If End If Wend Next i MsgBox usedfields End Sub