How and where do I place the function into the VB Editor
you can place the function in any module, probably the easiest is just after your sub, not in the sub

ActiveDocument.StoryRanges(wdMainTextStory).Select ' for some reason I still have
'to manually select the text as this line will not select
it works correctly when i test it here