The effect of a treatment on the hazard rate of a duration outcome may depend on the elapsed time since treatment. In addition, treatment effects may be heterogeneous across agents. The former gives rise to duration dependence of the treatment effect, whereas unobserved heterogeneity gives rise to spurious duration dependence of the observable hazard rate. We develop a model allowing for duration dependence and unobserved heterogeneity in the treatment effect. The model incorporates a Timing of Events model and allows for selectivity on unobservables. We prove identification, exploiting variation in the timing of treatment and outcome. In the application we analyze the effects of the Swedish vocational employment training program on the individual transition rate from unemployment to work. We demonstrate the appropriateness of the approach by studying the enrollment process. The data cover the population and include multiple unemployment spells for many individuals. The results indicate a large, significantly positive effect on exit to work shortly after exiting the program. The effect at the individual level diminishes after some weeks. When taking account of the time spent in the program, the effect on the mean unemployment duration is small. Copyright © 2012 John Wiley & Sons, Ltd.