#1
|
|||
|
|||
First word of sentence IF and then
Please help. My brain is exhausted. Here is what I am trying to accomplish: I need 1 command that incorporates 5 rules that I can execute with 1 macro to any word document. The rules relate to lists of words, which I have in excel. Rule 1: Add number lines to the document. Rule 2: (Column A in excel) 1)Find specific words (column A) 2) highlight those words only 3)IF they are at the beginning 4)OR end of a sentences within the document, 5) 4)add phrase after the highlight "Does not meet writing standard." I will then manually save the document and send it to a person to correct the highlight, 5)meaning the highlight can be removed. Rule 3: 1)Find specific words (column c in excel) 2) highlight those words only 3)IF they are at the beginning 4)OR end of a sentences within the document. 4)add the alternative word (column d) in 5)blue Rule 4: 1)Find specific words (column f in excel) 2) highlight those words only 3)IF they are at the beginning 4)OR end of a sentences within the document. 4)add the alternative word (column f) in 5)Green Rule 5: Insert a front page 2) Message: The following errors were noted in this document in 3)font color purple and 4) font size 14. Below the message 5) a table with 6)two columns that in includes 7)line number and row two 8)references Rule 6: Once I save the document and send it to the individual they are able to edit as normal. Any help would be greatly appreciated. |
#2
|
|||
|
|||
I am confused. If the words are in Excel
Quote:
Quote:
Quote:
Please try and describe in better detail. |
#3
|
||||
|
||||
awolf: You need to be aware that Word VBA's notion of what constitutes a sentence isn't what most readers would consider a sentence. For example, consider the following:
Mr. Smith spent $1,234.56 at Dr. John's Grocery Store, to buy: 10.25kg of potatoes; 10kg of avocados; and 15.1kg of Mrs. Green's Mt. Pleasant macadamia nuts. For you and me, that would probably count as one sentence; for VBA it counts as 5... This could have significant implications for your rules 2, 3 & 4.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#4
|
|||
|
|||
I apologize if I did not explain well.
I am using Excel to store singular words. The words in the column are what I want the Word Document to use to identify. So when I run the code, MS Word will reference the words from Excel. Kind Regards, |
#5
|
||||
|
||||
For code to use an Excel to store a word list for Find/Replace operations, see: https://www.msofficeforums.com/word-...d-replace.html. Compared to the approach there, it seems you'll need to either keep the workbook open while processing or create multiple find arrays in Word, one for each of your rules 2, 3 & 4.
As indicated in my previous post, though, you're liable to have problems implementing your rules 2, 3 & 4. It's also not clear how you propose to do the line numbering. Word has an automatic line numbering feature you could use. However, you also need to be aware that what appears on one line on your PC could be on a different line on another PC. That's because Word uses information from the active printer to determine the page formatting. And, of course, if one inserts a 'front page message', that could mess up the line numbering unless a Next page Section break is used and line numbering on the first page is disabled.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#6
|
|||
|
|||
Paul,
Does that take into account word count and Line count in Word? Thank you very much for the information. Just a quick brain storm - is it possible to import each sentence into Excel or is that the same problem. Kind Regards, Amy |
#7
|
|||
|
|||
Quote:
|
#8
|
||||
|
||||
This is your first reference to word count. How is that relevant? As for the line count, I don't know what more you want than what I've already said.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
Tags |
combine rules, macro |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Append text to a sentence containing specific word | dgp | Word VBA | 3 | 02-28-2014 10:38 PM |
Find/Replace, Duplicating a word in a sentence to hundreds of sentences. | DDDD | Word | 0 | 10-08-2013 10:48 AM |
lost space sentence word 2010 in 2007 | rahmat | Word | 2 | 09-17-2013 06:17 PM |
Space Between Each Sentence | dazwm | Word | 2 | 10-17-2012 04:19 AM |
I want to lock a sentence in Word | smorkette | Word | 1 | 02-06-2010 12:57 AM |