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!

Avoiding accessing deleted tasks via Unique ID

Status
Not open for further replies.

theburst

Technical User
Jun 27, 2007
9
US
There is probably a basic answer to my question, however I don't have the programming background to find it and have been trying to figure it out for a day now.

Here goes.

I'm writing a macro that will place Tasks in the network diagram in specific locations. The macro calls an excel file which has three columns of information. The excel file contains the UniqueID, XPosition, and YPosition.

My problem is if the task has been deleted from the project, and the excel file still contians a reference to that Unique ID. When the macro tries to place the task that does not exist anymore, the code dies (as would be expected).

I need a way to check if that Unique ID still exists and if not just skip it.

I was thinking of possibly using something like
Code:
On Error Resume Next

to skip the error. I don't really want to skip the error, I'd rather just compare the unique IDs in the excel file to that in Microsoft Project, and if one has been deleted skip it.

Hope this is clear enough to understand.

Thoughts?
 
Also I'm not sure if this is the correct forum, maybe in VBA? Just thought that someone familar to Microsoft Poject might be more helpful.
 
I posted in the VBA forum and got a response. Not sure if there is a way to delete the thread.
 
I think this is the answer he got.

On Error Resume Next
Set jTask = ActiveProject.Tasks.UniqueID(UniqueIDNum(I))
If Err.Number <> 0 Then
Err.Clear
Else
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top