View Single Post
 
Old 03-21-2023, 04:06 AM
ChrisGreaves ChrisGreaves is offline Windows 10 Office 97-2003
Novice
 
Join Date: Nov 2022
Location: Bonavista, Newfoundland
Posts: 22
ChrisGreaves is on a distinguished road
Default

Quote:
Originally Posted by ctviggen View Post
I am trying to use VBA for many repetitive tasks performed by our organization.
We use Word Styles for this:
- The numbered paragraphs are one style
- The non-numbered paragraphs that follow the numbered paragraphs are a different style.
Hello ctviggen,
Using VBA and Syles is an excellent way to automate boring and repetitive tasks. Congratulations.
Back in 1996 I wrote a Wpord6.0 application, migrated to Word97 then Word2003 called "Document Cleanser". I believe it still works.


My job at that time was to convert thousands of WordPerfect 5.1(DOS) documents to MSWord documents and to clean them along the way.


WP5.1 documents tended to have literal numbering and no styles. Worse numerous temporary editors often copy/pasted gobs of text without re-sequencing the numbers. A nightmare.


Document Cleanser is a rules-based application; a table of rules, controlled by you, determines exactly how the converter works. I have attached two Word2003 document files.


"HardCodedNumberingRules.doc" is a sketch of my ideas about how to resolve a specific hard-code numbering problem


"RulesTable20050126.doc" is a sample rules table, possibly related to my ideas outlined in "HardCodedNumberingRules.doc"



Do not be overwhelmed by the size or apparent gobbledygook of the rules table; they grow in chunks as you test new rules and add them in. And remember this is for batches of 10,000 documents at a time.


Notice that the "Find" and "Replace" columns look suspiciously like the Special command button in MSWord's Find/replace dialogue box. (grin)


Rules (34) through (62) change hard-coded numbers to simple paragraphs in a List Outline style. You can, of course, Replace with whatever text you choose and whatever style you possess.


Rules (86) through (92) convert fixed local-formatting to character-style formatting.


If you think that this sort of approach might solve your problem let me know and we'll talk. The package is free and includes many sample rules tables and an eight-page User Guide.


I can't remember whether the code to loop through 10,000 documents is included, but I'll have a look later. It is spinning around here somewhere.

Cheers, Chris
Attached Files
File Type: doc HardCodedNumberingRules.doc (34.0 KB, 0 views)
File Type: doc RulesTable20050126.doc (249.5 KB, 0 views)
Reply With Quote