Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Pasting values in the Predecessor tab in Task Information Dialog

Status
Not open for further replies.

nm862

Technical User
Jun 30, 2010
1
US
Have to enter roughly 60 row numbers as Predecessors using the Tax Information dialog box (I've exceeded the character count on the project plan). I've tried pasting from an excel table and it doesn't work. Is there a method to mass input a large set of rew numbers without having to manually enter each one in.
 
I tried a bunch of different approaches (probably the same ones you tried) and came to the same conclusion that you did: it doesn't seem possible.

Here's some VBA that may help.

Code:
Option Explicit
Sub pdqBach()
    Dim tsk As Task
    Dim lLoop As Long
    Dim vReply As Variant

    If ActiveSelection.Tasks.Count = 0 Then
        MsgBox "No tasks selected"
        Exit Sub
    End If
    
    On Error GoTo pdqBach_err
    vReply = "abc"
    Do While Not IsNumeric(vReply)
        vReply = InputBox$("Enter the task ID")
    Loop
    If vReply = 0 Then
        Exit Sub
    End If
    
    Set tsk = ActiveProject.Tasks(CLng(vReply))
    For lLoop = 1 To ActiveSelection.Tasks.Count
        ActiveSelection.Tasks(lLoop).LinkPredecessors Tasks:=tsk
    Next
    Exit Sub

pdqBach_err:
    MsgBox ("Task " & vReply & " not found or you tried to make it a predecessor of itself.")
End Sub

In order to use this:
Alt+F11 to display the VBA dialog
If you see a grey panel then:
click on Insert > Module

Select the code above and paste it in

Steps to run:
1. Click on the MS Project window to switch to it
2. Note the task ID that will be getting predecessors
3. Click and select all the predecessor tasks
4. Click on the VBA window to switch to it
5. Click on the code
6. Press F5
7. Answer the prompt with the task ID you noted in step 2

Lather, rinse, repeat.

The code preserves any preexisting predecessor information.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top