Sorry i was not clear enough in my previous quote. But i already managed, the custom fields on Project level are available. The code i created to check if task have been added:
Sub Max_UniqueID()
Dim t As Task
Dim Max_UniqueID As Long
MsgBox "This was the Max UniqueID in the project before: " & ActiveProject.Text1
For Each t In ActiveProject.Tasks
If Not t Is Nothing Then
If t.UniqueID > Max_UniqueID Then Max_UniqueID = t.UniqueID
End If
Next t
If Max_UniqueID <> ActiveProject.Text1 Then
MsgBox "Please check there are tasks added to the plan, previous: " & ActiveProject.Text1 & " Now: " & Max_UniqueID
ActiveProject.Text1 = Max_UniqueID
End If
End Sub