Recent Kepler photometry has revealed that about half of white dwarfs (WDs) have periodic, low-level (~ 1e-4 - 1e-3), optical variations. Hubble Space Telescope (HST) ultraviolet spectroscopy has shown that up to about one half of WDs are actively accreting rocky planetary debris, as evidenced by the presence of photospheric metal absorption lines. We have obtained HST ultraviolet spectra of seven WDs that have been monitored for periodic variations, to test the hypothesis that these two phenomena are causally connected, i.e. that the optical periodic modulation is caused by WD rotation coupled with an inhomogeneous surface distribution of accreted metals. We detect photospheric metals in four out of the seven WDs. However, we find no significant correspondence between the existence of optical periodic variability and the detection of photospheric ultraviolet absorption lines. Thus the null hypothesis stands, that the two phenomena are not directly related. Some other source of WD surface inhomogeneity, perhaps related to magnetic field strength, combined with the WD rotation, or alternatively effects due to close binary companions, may be behind the observed optical modulation. We report the marginal detection of molecular hydrogen in WD J1949+4734, only the fourth known WD with detected H_2 lines. We also re-classify J1926+4219 as a carbon-rich He-sdO subdwarf.