Fixed it, it needs to go in CView::OnPrepareDC(), and stop the printout if we have gone past the To page:
void CMyView::OnPrepareDC(CDC* pDC, CPrintInfo* pInfo)
{
CView::OnPrepareDC(pDC, pInfo);
if ( pInfo )
{
if ( pInfo->m_nCurPage > pInfo->GetToPage() )
pInfo->m_bContinuePrinting = FALSE;
}
}