Getting Error Message while running Macro

J

Jayalakshmi

Hi,

I am getting Error message while running Macro in MPP as "The Argument Value
is not valid".

Can yopu please tell me the solution for this?

Thanks & Regards,
Jaya
 
J

Jack Dahlgren

Posting the code for the macro and where it is stopping would be useful for
determining the solution to your problem. Can you post the code here?

-Jack Dahlgren
 
J

Jayalakshmi

Hi,

I am having Enterprise Projects in Project Server 2003. While running this
macro, for some projects its showing result in "Enterprise Cost" field. For
some projects its showing error message as specified in my previous mail. Pl
give me some solution.

Sub MaterialsCost()
Dim Tsk As Task
Dim Res As Resource
Dim Assgn As Assignment
For Each Tsk In ActiveProject.Tasks
If Not Tsk Is Nothing Then
Tsk.EnterpriseCost1 = 0
For Each Assgn In Tsk.Assignments
Set Res = ActiveProject.Resources(Assgn.ResourceID)
If Res.Type = pjResourceTypeMaterial Then
Tsk.EnterpriseCost1 = Tsk.EnterpriseCost1 + Assgn.Cost
End If
Next Assgn
End If
Next Tsk
End Sub



Thanks & Regrds,
Jaya
 
J

Jayalakshmi

Rod,

Yes, its yours. While running macro in Project its showing error Messgae
that "This argument is not Valid". Its not showing result in Custom Field.But
its not mentioning the line of code!

Thanks
Jaya
 
R

Rod Gill

There is no on error resume next statement, so when there is an error it
should should a message with and end and a debug button on it. Click the
debug button and tell us which statement is highlighted in yellow.

--

Rod Gill
Microsoft MVP for Project

Author of the only book on Project VBA, see:
http://www.projectvbabook.com
 
J

Jayalakshmi

Hi Gill,

Its showing error in 7th line(Tsk.EnterpriseCost1=0) of the below specified
code.

Sub Material_Cost()
Dim Tsk As Task
Dim Res As Resource
Dim Assgn As Assignment
For Each Tsk In ActiveProject.Tasks
If Not Tsk Is Nothing Then
Tsk.EnterpriseCost1 = 0
For Each Assgn In Tsk.Assignments
Set Res = ActiveProject.Resources(Assgn.ResourceID)
If Res.Type = pjResourceTypeMaterial Then
Tsk.EnterpriseCost1 = Tsk.EnterpriseCost1 + Assgn.Cost
End If
Next Assgn
End If
Next Tsk
End Sub

Help me wi th this.

Thanks & Regards,
Jaya
 
J

Jayalakshmi

Hi Gill,

Help me!

I am using this Macro in MS Project Professional 2003. This macro is running
& getting result in which project is not having WBS. If a project is having
WBS, Macro is not running & its showing error that "This argument is not
valid". What to do? Can you give solution for this?

Thanks in Advance!

Regards,
Jaya
 

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