A new method of calculating total energies of solids which uses nonlocal pseudopotentials in conjunction with the variational quantum Monte Carlo approach is presented. By use of pseudopotentials, the large fluctuations of the energies in the core region of the atoms which occur in quantum Monte Carlo all-electron calculations are avoided. The method is applied to calculate the binding energy and structural properties of diamond. The results are in excellent agreement with experiment.