Using Setfield ??

G

glenn

Why might this code be crashing? Seems straight forward to me...

Sub PlaceDefineScopeInTaskOne()
Dim lvoTask As Task
Set lvoTask = ActiveProject.Tasks(1)
lvoTask.SetField pjTaskName, "Define Scope"
End Sub
 
E

Ed Morrison

I cut and paste this code into Project Pro 2003 and it changed task 1's name
as expected. What is the error you are receiving? Would
lvoTask.Name="Define Scope" work in your situation?
 
G

Glenn

Ed,
I am getting "Argument Value is Invalid" for the line
Set lvoTask = ActiveProject.Tasks(1)

glenn
 
L

Lars Hammarberg

Make sure the task with ID1 isn't a blank line - if it isn't, I'd try the
code on a newly created project and see if that works.
 
G

Glenn

Thank you. That was it. It did not like the empty
field. Invalid argument type is a pretty nebulous
complaint from the debugger.

Thanks for your help.
 
J

Jan De Messemaeker

Just this.
This is not a matter of an empty FIELD
It's about an empty LINE which creates a task hat is Nothing.
HTH
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top