Consulting

Results 1 to 3 of 3

Thread: How can i save the highest Unique task ID in a project level custom field.

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #3
    VBAX Newbie
    Joined
    Feb 2022
    Posts
    5
    Location
    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
    Last edited by Bob Phillips; 03-01-2022 at 03:21 AM. Reason: Added code tags

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •