Word-Scripting: replace nonbreaking spaces with thin spaces? -
I use the term to open (special) HTML documents for printing and fix a small problem I want to write a script for:
In the html file I have the number of '15cm' which is '15 & nbsp; Cm ', so there will be no line break between the number 15' and the unit 'cm'.
My problem is: The vacancy is very broad, especially when the word spreads to spread the vacancies on the margins.
So I want to change these & nbsp; With the use of a word VBA script, I think that I need to calculate the paragraphs, but I'm not sure how the text should be replaced there. This is what I have come up to yet, but I do not know how to write the HTML NP in the word and what to use for the thin spaces, maybe someone can help me here?
Sub-MakeThinSpaces () for paragraphs of each paragraph ActiveDocument. Paragraphs as DimPara & amp; Nbsp; Replace with some more Thinsp; here? The next ending sub
The diluted location is Unicode 8201. (Narrow non-break space ho 8239) It should work with this code using the selection object.
is a safe place for wildcard, you can also use Chr (160)
Selection .HighStory with selection. Find out. Text = "^ s". Replacement.Text = ChrW (8201) .MatchWildcards = True End With Selection Change Find.Execute: = wdReplaceAll
Comments
Post a Comment