Because of a bug in the ActiveX API, the "ActiveSpace" property does not indicate whether the current space is model or paper space. It only tells you if the Active Layout is a paper space layout or the model tab. To find out the current space regardless what kind of layout is active, use the CVPORT system variable (if it's 1, you're in paper space).