![]() |
|
![]() |
|
Thread Tools | Display Modes |
|
#1
|
||||
|
||||
![]()
Unfortunately, with the wonder of hindsight, just about everybodies code could be improved once its been created. Looping through every character is horrendously slow and it appears you are probably doing this more than once so that magnifies it.
It might be worth taking a step back and looking at your requirements once again to see how to make the code really efficient. I would recommend getting away from Selections and strings in favour of ranges. For the job you describe here it would be WAY faster to do find/replaces instead of looping characters. eg with wildcards on find "([! ])\[\[" and replace with "\1 [[" to ensure there is always a space in front of any opening double square brackets
__________________
Andrew Lockton Chrysalis Design, Melbourne Australia |
#2
|
|||
|
|||
![]() Quote:
EDIT: but it adds a space between deleted content and punctuation outside the deleted content, so I might end up with, for example, [[4]] , instead of [[4]], which is what is desired. Maybe a cheap fix would be to only add whitespace (where it doesn't exist) between underlined text and [[, or between ]] and underlined text? That way it would at least fix [[this]]sort of thing when [[this]] sort of thing is desired. Last edited by Robert K S; 07-20-2016 at 07:55 AM. |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
ljd108 | Word VBA | 11 | 08-28-2024 01:20 AM |
![]() |
RickLegrand | Word | 7 | 07-23-2015 06:35 PM |
![]() |
mohsen.amiri | Word | 2 | 02-19-2015 11:38 PM |
![]() |
kcbenson | Word | 2 | 10-16-2014 01:31 PM |
![]() |
shahin3121 | Word | 2 | 03-05-2012 06:16 PM |