Your question really has nothing to do with VBA, but everything to do with field coding. Furthermore the field coding for what you want is relatively complex, as Word doesn't natively support dual numbering schemes. The 'Page X of Y' aspect for the document as a whole is quite easily obtained via Word's PAGE and NUMPAGES fields, and the 'Y' part of the 'Page X of Y' aspect for a given Section is equally easily obtained via a SECTIONPAGES field. For the first Section, a simple PAGE field can also be used for the 'X' part. It's for subsequent Sections that getting the 'X' part for a Section becomes complicated. The first thing you'll need to do is to unlink each Section's header from the one preceding it. Then add a field coded as:
{SET Sctn# {SECTIONPAGES}}
in each Section's header except the last, where # is the Section number. Then, in each subsequent Section's header, you'll need a formula field like:
{={PAGE}-Sctn1}
for the 'X' part in Section 2:
{={PAGE}-Sctn1-Sctn2}
for the 'X' part in Section 3, and so on.
Note: The field brace pairs (i.e. '{ }') for the above examples are all created in the document itself, via Ctrl-F9 (Cmd-F9 on a Mac); you can't simply type them or copy & paste them from this message. Nor is it practical to add them via any of the standard Word dialogues.