That suggests you placed the code somewhere other than before the final 'End With'. For consistency with the approach I took elsewhere, I'd retain the wdHeaderFooterPrimary constant and insert:
Code:
Const wdHeaderFooterPrimary As Long = 1
up where the other Word constants are defined.