Hi,

I'm new to VBA programming, and when opening a file from my teacher I encountered a problem. I activated Macroes and got the following message: "Compile error: Can't find project or library" where

"Function expectedTailLoss(obs, cut)" and "nrOfObs =" was highlighted.

I have tried to read on the net and in this forum, but most suggest to press "Reset", go to "tools" and "references" to add what is missing. But whenever I press Reset I get the same message and it is not possible to press "References".

I need to say that the file works with no problems on a lot of other computers.

Additional information: I run Windows Vista.
I have added the solver and the different toolpacks.


Function expectedTailLoss(obs, cut)
' obs:  return observations (or amount observations)
' cut:  the critical return (or amount)

nrOfObs = obs.Count ' with .Count, we determine number of elements in obs

nrOfLoss = 0
cumLoss = 0
For i = 1 To nrOfObs

    If obs(i) <= cut Then
        nrOfLoss = nrOfLoss + 1
        cumLoss = cumLoss + obs(i)
    End If
    
Next i

expectedTailLoss = cumLoss / nrOfLoss

End Function

Any help is greatly appreciated - thank you in advance

Regards
Thomas