View Single Post
 
Old 10-08-2013, 01:26 AM
slaycock slaycock is offline Windows 7 64bit Office 2013
Expert
 
Join Date: Sep 2013
Posts: 255
slaycock is on a distinguished road
Default

Hi Macropod

Apologies for being stupid. I should have recognised the regex expression. My only excuse is that I didn't recognise the two Chrw so just assumed they were something special in word.

Your suggestion of using chrw(12288) was one of the methods that I tried once I worked out what the character value was. As I reported above all that happens is that each and every space character in the document is replaced by a tab.

The specific code I used is as below

Code:
With ActiveDocument.StoryRanges(wdMainTextStory).Find
  .ClearFormatting
  .Replacement.ClearFormatting
  .Text = ChrW(12288)
  .Replacement.Text = "^t"
  .Wrap = wdFindContinue
  .Execute Replace:=wdReplaceAll
End With
If you try the above on the sample document I provided you will see the problem. I'm certainly finding it perplexing.

Last edited by macropod; 10-08-2013 at 02:01 AM. Reason: Added code tags & formatting
Reply With Quote