Within the Hartree-Fock theory of atoms and molecules we prove existence of a ground state in the presence of an external magnetic field when: (1) the diamagnetic effect is taken into account; (2) both the diamagnetic effect and the Zeeman effect are taken into account. For both cases the ground state exists provided the total charge $Z_{\rm tot}$ of the nuclei $K$ exceeds $N-1$, where $N$ is the number of electrons. For the first case, the Schr\"{o}dinger case, we complement prior results by allowing a wide class of magnetic potentials. In the second case, the Pauli case, we include the magnetic field energy in order to obtain a stable problem and we assume $Z_{\rm tot} \a^{2} \leq 0.041$, where $\a$ is the fine structure constant.