Error trying to change the bookingtype

H

hperron

Hi,

In a macro, I try to change the bookingtype of a resource, but I always
get the message

"unexpected error with the method" (or something like that, the message
is in french)


Private Sub changeBookingType()

Dim res As Resource
Dim bookingType As PjBookingTypes

If
ActiveProject.ProjectSummaryTask.EnterpriseProjectOutlineCode1 =
"Proposition" Then
bookingType = pjBookingTypeProposed
Else
bookingType = pjBookingTypeCommitted
End If

For Each res In ActiveProject.Resources
res.bookingType = bookingType 'The error happens here

Next res

End Sub

Can someone help me resolve that problem.

Thanks in advance

Hugues
 
H

Haris Rashid

hi,

change Dim bookingtype As PjBookingTypes

to Dim MyBookingtype As PjBookingTypes

Regards,
 
H

hperron

Hi Haris

Thanks for your answer, but I don't understand why changing the
variable name would fix the problem. Even if I put a value directly to
the bookingtype, the error occurs

res.bookingType = 1 (for example)

Anyway, I will try your suggestion.

I think it's more a value problem. res.bookingtype is expecting a long
and the constants are 1 or 0. Maybe the property res.bookingtype is
waiting something else than 1 or 0.

Hugues
 

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