40th harmonic is power quality measurement standard, e.g. referred in IEC 1000-3-2. But it may be unnecessary for your application. To measure 7th harmonic, you need at least 500 Hz sampling frequency (Nyquist rate), effectively more for input feasible filters.
I suggest that you estimate the error due to window length unequal to an integer multiply of fundamental period. If you feel it's too high, you may measure the fundamental frequency separately and adjust the window length. That's simple as long as the FFT length is larger or equal than the maximum window.