There's this nice functionality in MS Word that gets rid of leading and trailing spaces in the entire document whenever you select the whole text and center it, then go back to desired alignment.
So this (space)(space)(space)text text text(space)(space) should result with this text text text
It has repeatedly worked for me when I do it manually by clicking on the center icon on quick access toolbar or ribbon in Word. But whenever I use the code below to manage the same automatically via macro, this solution doesn't work for me. Those undesired spaces are still there.
Selection.WholeStory
Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter 'after this, there should be no leading/trailing spaces anymore
Selection.ParagraphFormat.Alignment = wdAlignParagraphJustify
Have you experienced this before? Can you replicate such result?