Tasks UniqueID Argument error RRS feed

  • Question

  • Anytime I try to execute a line of code that references the a task's UniqueID or GUID I get a runtime error of "argument value is not valid".

    Example:  MsgBox "Duration = " & ActiveProject.Tasks.UniqueID(1).Duration

    I can't seem to figure out why it won't accept the values that I am passing. 

    Any help or direction is appreciated.



    Monday, October 14, 2013 9:17 PM

All replies

  • mps92103,

    What version of Project are you using? Is it updated with the latest service pack?

    I just tried your expression on a simple file running under Project 2010 with SP2 and the June 2013 cumulative update and it works fine.


    Monday, October 14, 2013 11:43 PM
  • You will get an error if UniqueID doesn't exist. UniqueId(1) will only work if the first task you ever created in the file hasn't been deleted. This is not row 1 or Id1. Insert the Unique Id column and make sure it still exists.

    Rod Gill

    The one and only Project VBA Book

    Rod Gill Project Management

    Tuesday, October 15, 2013 5:28 AM
  • I discovered the issue was related to having tasks across multiple projects.  Once I consolidated the projects and ran the program it worked fine.

    Appreciate your responses!

    Tuesday, October 15, 2013 6:02 AM