
Reading Resources and Resource properties in macros
Thank's a lot for your quick and usefull help !
... and a Happy new Year ;-)
Jordi
Jordi
In your project you have blank resource rows i.e. resource id's 1 to 6 are
blank. Your valid resources are only of id's 7 to 9. So in the your program
loop when R=1, it is trying to access the properties of resource 1 as
ActiveProject.Resources(1).Name where as the resource actually does not
exist. This will generate an error. So in your loop, you need to see if the
resource is nothing and access it's properties only if the resource is not
nothing. I have added the required code, which is in bold.
Sub ResourcesTest()
Dim R As Long, Names As String
For R = 1 To ActiveProject.Resources.Count
If Not ActiveProject.Resources(R) Is Nothing Then
Names = ActiveProject.Resources(R).Name & ", " & Names
End If
Next R
Names = Left$(Names, Len(Names) - Len(ListSeparator & " "))
MsgBox Names
End Sub
Regards
Venkata Krishna
Quote:
> Thank's Venkata for your quick answer !
> I tried to reduce my mpp file as requested but can't clear it under 200 K;
> why ? is there some masked things within it ?
> Further your answer I tried to run the code in a new project and it worked
> !!! What is the problem with that file ?
> Thank's in advance for your help.
> Jordi