I have a VBA macro that I use to clean up converted documents in Word. One of the first steps in the macro converts all whitespace (space, non-breaking space, tab) to a single space for each occurence (multiple whitespace characters merge down to a single space). I'm using Find/Replace, where the Find text is ^w and the Replace text is " ". This has worked fine for several years now.
Today, I modified the clean-up macro to add a couple more steps, and I went about running the macro for all of the documents impacted by this. Actually, I'm doing a subset at a time as there are several Find/Replace steps in the macro. All of the documents should have single character spacing throughout from having previously run this macro.
What's confusing is the above whitespace step shouldn't change the document, and by appearances it hasn't. But the size of the documents have increased by 30-40%. The character counts and pages are nearly the same (I say "nearly" because of the added steps which could merge a few words/symbols).
As a test, I modified the macro to comment out the whitespace step, and the file sizes have barely changed, which is what I would have expected. Running the macro with just the whitespace step increases the file sizes. Maybe even stranger than all of this is any conversion of the updated Word document into PDF for archive results in a large PDF file also.
Is there something about the above Find/Replace whitespace step that has a gotcha in it with respect to its use?
Today, I modified the clean-up macro to add a couple more steps, and I went about running the macro for all of the documents impacted by this. Actually, I'm doing a subset at a time as there are several Find/Replace steps in the macro. All of the documents should have single character spacing throughout from having previously run this macro.
What's confusing is the above whitespace step shouldn't change the document, and by appearances it hasn't. But the size of the documents have increased by 30-40%. The character counts and pages are nearly the same (I say "nearly" because of the added steps which could merge a few words/symbols).
As a test, I modified the macro to comment out the whitespace step, and the file sizes have barely changed, which is what I would have expected. Running the macro with just the whitespace step increases the file sizes. Maybe even stranger than all of this is any conversion of the updated Word document into PDF for archive results in a large PDF file also.
Is there something about the above Find/Replace whitespace step that has a gotcha in it with respect to its use?
Last edited: