There is a very strange myth about page files. Some people think a whole program is either paged in or paged out. This is not correct. Whilst it is entirely possible for a whole program to paged in or out, by coincidence. This is not the actual granularity that paging operates on.
All virtual memory operates on a 4KB scale. A page of memory is always 4 kilobytes. This is just how x86 and AMD64 instruction set CPUs are. By comparison, Intel Itanium has 8KB pages.
Using the file cabinet analogy, think of this 4KB pages as an A4 sheet of paper. That's the ONLY size that the cabinet can store. In fact that is the only size of paper allowed on both the desk AND the inside the filing cabinet.
It is entirely possible for 90% of a program to be paged out but just the remaining 10% to be paged in (i.e. in RAM) and for that program to execute just fine. In this scenario the memory manager would have realised that hardly any of the program was needed to be in RAM so it decided to page most of it out. If for some reason the program needs one of those paged out pages of memory. It can still request it. But the MMU unit on the CPU will realise the requested page of memory is paged out (yes this stuff is baked straight onto CPUs) and it will raise a 'page fault' hardware interrupt. The kernel will intercept this interrupt and respond to it by bringing that page of memory back in from the page file and locating it in a free piece of RAM. If necessary, it will page OUT some other idle page of memory in order to make room for the active page fault. Then it will schedule the thread of the interrupted process again so that it can resume from where it left off and access the page of memory that it requested.