Compare text

I have two huge paragraphs. I want to check if both of them are same.
Can macros help me in easing this process? If I have left out any word
in the para it shd should indicate which word I have left out. Is that
possible?

thanks for the help
0
Sahana
11/11/2009 4:54:55 AM
word.vba.general 1023 articles. 1 followers. Follow

1 Replies
2031 Views

Similar Articles

[PageSpeed] 9

The following macro should work. Enter the numbers of the first and second 
paragraphs to check in the dialog boxes. If the paragraphs are the same the 
macro will report that. If not it will highlight the first non-matching 
character in the second chosen paragraph.

Sub CompareParagraphs()
Dim FirstPara As Range
Dim OtherPara As Range
Dim iP1 As Integer
Dim iP2 As Integer
iP1 = InputBox("Enter number of first paragraph to check")
iP2 = InputBox("Enter number of the paragraph to compare")
Set FirstPara = ActiveDocument.Paragraphs(iP1).Range
Set OtherPara = ActiveDocument.Paragraphs(iP2).Range
If FirstPara.Text = OtherPara.Text Then
    MsgBox "Paragraphs are the same", vbInformation, _
    "Compare paragraphs"
Else
    If FirstPara.Text > OtherPara.Text Then
        For i = 1 To FirstPara.Characters.Count
            If FirstPara.Characters(i) <> OtherPara.Characters(i) Then
                MsgBox "The Character " & OtherPara.Characters(i) & _
                " at position " & i & " doesn't match!", _
                vbInformation, "Compare paragraphs"
                OtherPara.Characters(i).Select
                Exit For
            End If
        Next i
    Else
        For i = 1 To OtherPara.Characters.Count
            If FirstPara.Characters(i) <> OtherPara.Characters(i) Then
                MsgBox "The Character " & OtherPara.Characters(i) & _
                " at position " & i & " doesn't match!", _
                vbInformation, "Compare paragraphs"
                OtherPara.Characters(i).Select
                Exit For
            End If
        Next i
    End If
End If
End Sub

http://www.gmayor.com/installing_macro.htm

-- 
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor -  Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>



Sahana wrote:
> I have two huge paragraphs. I want to check if both of them are same.
> Can macros help me in easing this process? If I have left out any word
> in the para it shd should indicate which word I have left out. Is that
> possible?
>
> thanks for the help 


0
Graham
11/11/2009 8:00:20 AM
Reply:

Similar Artilces:

comparing columns
I have a master Excel worksheet, which has six columns:- C:D:E:F:G:H and there are approximately one thousand rows. On a daily basis I import data into Column A. of this master worksheet. The data consists of lots of different 10 digit numbers, so I have a different 10 digit number in each row of Column A., an example of which follows:- A 1234567896 1721626196 3333445556 7768754321 9675332699 The amount of rows that I import also varies daily, it can be as low as five rows of 10 digit numbers imported, or approximately 999 rows of 10 digit numbers imported. The rest of th...

Selecting text in CRichEditView
I want to only select characters that I click and drag the mouse pointer over in my CRichEditView and not have the entire word selected as soon as I cover the first character in that word. I'm having trouble finding help on how to change this "auto-select" feature. Will someone please point me in the right direction? Thanks, Lowell. No takers on this one? Lowell "Lowell Specht" <specht@mindspring.com> wrote in message news:13ebb36bh4sbvdc@corp.supernews.com... >I want to only select characters that I click and drag the mouse pointer >over in my ...

How do i make text see thru
I want my background picture to show thru the text, and i want the text the have a smoked glass look, is this possible clare I know how to make the text show through because I asked it here once, click on fill (up top) then "no fill". I use this a lot because otherwise the text box blocks something out or a part of it. As for smoked glass, I'm not sure with Publisher if they have this effect. I just tried it (and I'm still a newbie) I made a text box, wrote TEST on it, made the font grey. Then clicked fill- effects and tried some of the graduants which were in shades of ...

Display Date Range In Text Box
I have a pie-chart on my main menu that totals the number of billable hours for each Service Technician for the last week (always 7 days from today.) How would I make a text box display the actual date range, much like what is done in reports. I'd like it to look like this: From: 2/7/2008 To: 2/7/14/2008 I don't think I can use the query that generates the data for the pie-chart becuase it would have to be outside that sub-form on my main menu. My main menu does not have a data source. If you have any ideas, I'd appreciate it. Thx, JK, If your chart always prints in ...

What's the best free pdf to text or rtf converter?
Can't convert with free version of Foxit Reader, works well to read the new format pdf's, but does not convert to text free-pdf-to-word-converter.exe 588KB Free PDF to RTF Converter 1.5 seems to reorganize the simplest of pdf's For example a numbered list of text ends up with all the numbers AFTER each entry! I think I tried pdf2Wordsetup.exe 1,103KB and it was worse So, what free pdf to text, or to doc or to rtf works the best on Win98FE? Robert Robert A. Macy wrote: > Can't convert with free version of Foxit Reader, works well to read > the...

Text not appearing in webpage
I am using Frontpage 2003 and I am typing text directly into the Frontpage document but when I save and try to view my text on the web browser my text isn't showing up. What is going on??!!?? Try clearing your browser cache. -- ~ Kathleen Anderson Microsoft MVP - Expression Web Spider Web Woman Designs Expression Web Resources: http://www.spiderwebwoman.com/xweb/ Expression Web Wiki: http://expression-web-wiki.com/ FrontPage Resources: http://www.spiderwebwoman.com/resources/ Please reply to the newsgroup for the benefit of others "Ashley" <Ashley@disc...

Countif formula for specific text within range
Version: 2008 Operating System: Mac OS X 10.5 (Leopard) Processor: Intel I want to count the number of times a specific text (e.g. Public Transportation) appears within a range. The cells appear as follows: <br><br>Employment; Public Transportation <br> Public Transportation <br> Public Transportation; Rural Development <br><br>I tried using &quot;Public Transportation&quot; as the criteria, but it doesn't count the cells containing other text beside it. <br><br>Appreciate some help. ...

Convert Date-as-Text
Using Excel 2000 I have an Excel worksheet (.xls) that was produced by an accountant exporting data from a particular accounting package. There is a colum of dates of the m/d/yyyy format that don't sort as dates. They sort alphabetically, which is of no use. I'm looking for the VBA function that will convert text in the m/d/yyyy format to an Excel date number. Cells(n, m).formula = DateConverter(Cells(n, m).value) or some such And I will then write a loop macro to process each cell in the column/range to convert the cell contents to an Excel date of the usu...

CrossTab Query that shows original data (text)
I am a scheduler and would like to build a pivot table in Excel or a Cross Tab Query in Access that shows the data in its original form (text) instead of calculating the count, sum, avg., etc. Row headings would have member’s names. Column headings would have times. Data items would be the name of the assignment. Any suggestions would be appreciated. Thanks. Jim G You can use a text field for the Value of a crosstab with FIRST or LAST or MIN or MAX. -- Duane Hookom Microsoft Access MVP If I have helped you, please help me by donating to UCP http://www.access.hookom.net/UCP/Default.h...

Set the number of line characters in Outlook (Plain Text)?
I need to set the line characters in Outlook so they don't look awkward when emails I send are received. I assume 68 characters may be a good length, but I have been unable to locate where to make adjustments. "LKV" <LKV@discussions.microsoft.com> wrote in message news:CD89E737-801C-4BE4-BE7C-9FBD66999BCE@microsoft.com... >I need to set the line characters in Outlook so they don't look awkward when > emails I send are received. I assume 68 characters may be a good length, but > I have been unable to locate where to make adjustments. You didn'...

MIRROR EFECTS, TEXT
H I want to display text as you would view it in a mirror, any one with ideas on how to do this Select the Text Frame, copy it to the clipboard by Ctrl+C Then go to menu EDIT select Paste Special, then select 'Paste as Picture' or 'Paste as device independent Bitmapped image' or 'Paste as Windows Metafile' or something similar to the those, dependent on which version of Publisher you are using. You will now have a picture, and you can just use the horizontal flip - you now have mirror text. -- The US should free all those illegally held prisoners they are torturin...

Colored text in Windows Explorer
When running a "search for files" in Windows Explorer most files are shown in black but some are shown in blue. What is the significance of the blue files? I am running WinXP Home Edition with SP3. Compressed files are Blue. Encrypted files are green. "PSRumbagh" <PSRumbagh@discussions.microsoft.com> wrote in message news:45444E11-4354-4D15-AB96-DDF8995BD0F7@microsoft.com... > > When running a "search for files" in Windows Explorer most files are shown > in > black but some are shown in blue. What is the significance of the b...

Why can't I see all the text in a cell?
I am entering text into a cell. It is a rather large string of sentences. I can not view the entire content of the cell unless I strike F2 to edit. I have tried to auto fit the row, but that does not work either. The text is not able to be viewed in Print preview, nor does it show in hard copy. Any ideas? This is in the help file:- Length of cell contents (text) 32,767 characters. Only 1,024 display in a cell; all 32,767 display in the formula bar. "woody" wrote: > I am entering text into a cell. It is a rather large string of sentences. I > can not view the e...

turn text upside down
I develop a fingerprint application on pocket pc and I need to display message during the capture process. So for now I use an edit box but I would like to make a rotation of 180 � to make the message readable by the people whom I capture the fingerprint. Should I just make a rotation of the graphic display, I mean just of the edit box area or is there any other mean ? I don't know about using an edit control to display text at an angle, but you can use a static control to do that. Do a search in MSDN or VC++ Help for "Rotating Lines of text." It basically comes down to rota...

Replying to rich/plain text emails
Outlook 2003/Windows XP Professional When I reply to an email that was sent in plain or rich text formatting I would like to have it reply in HTML format because my signature was created in word with a hyperlink and anything other than HTML formatting screws up my signature. Any suggestions or tips. Thanks, Rob Not possible; Outlook replies in the format of the original message. Note that the sender might be using that format for a reason. -- Robert Sparnaaij [MVP-Outlook] www.howto-outlook.com Tips of the month: -Backup and Restore -Create an Office XP CD slipstreamed with Service...

Using years as text in a bar chart
I have a simple two column sheet with with a series of years (1988-2003) in one column and amounts in the second column. I've formatting the cells in the years column as text. Yet when I attempt to create a bar chart, the chart still treats the years as numbers, i.e, 1988 as if it were the number 1,988. If I put in the names of something in that column (say car models as an experiment - all letters, no numerals), the chart comes out as intended. I must be missing something simple here when formatting the cells, but I haven't found it yet. Thanks! PD --- Message posted from h...

Creating a link to the text in a textbox
In some of the Publisher templates (Newsletters), the text in the footer is automatically updated when the text in another textbox (for Instance "Volume 1, N 1") changes. How can I create such a link? I do not find a field such as StyleRef, I cannot refer to the contents of a bookmark as you can do in Word, and paste link within the publication does not work???? RM ...

Combining multiple columns of text
I have a file of addresses. Each individual line of the address is in a different adjacent cell. I would like to be able to combine the text into one cell that is separated by commas, and or spaces. Is there an easy way to achieve this -- Amber Are you making labels? If yes, then keep your data the way it is. It's much easier to combine the values than to separate it. Use excel as your data base and use MSWord as the application to make the mailing labels. You may want to read some tips for mailmerge. http://www.mvps.org/dmcritchie/excel/mailmerg.htm http://www.mvps.org/word/F...

Trying to convert uppercase to lowercase text
Can someone help me? I am trying to convert uppercase text to Sentence case. I have seen the "proper" commnd but it doesn't seem to work. I must be doing something wrong. I am on Excell 97. Thanks. Joe, here is a macro that will do it -- Paul B Always backup your data before trying something new Please post any response to the newsgroups so others can benefit from it Feedback on answers is always appreciated! Using Excel 97 & 2000 ** remove news from my email address to reply by email ** "Joe B" <j.bator@easternbk.com> wrote in message news:01c501c...

Text Box Problem
On a form, I am attempting to add numbers (currency) in a text box based on fields in a record. The sum displays correctly when there are values (or 0) in all of the 5 fields being added but displays nothing when one or more of the fields is NULL. Is there a way to force the sum to appear when one (or more) of the added fields is NULL? Thanks -- Dennis Nz(Field1, 0) + Nz(Field2, 0) + Nz(Field3, 0) + Nz(Field4, 0) + Nz(Field5, 0) -- Doug Steele, Microsoft Access MVP http://I.Am/DougSteele (no private e-mails, please) "denyoung" <denyoung@discussions...

Text look up
How do I pick up a particular word from a sentence in excel. For eg:- I need to pick up the word "blue" form the sentence "My shirt is blue in colour". I need a generic formula because there a number of sentences and a number of colours. What do you mean by pickup, get its start character? =FIND(lookup_word_cell, sentence_cell) -- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "Niju David" <Niju David@discussions.microsoft.com> wrote in message news:D00DA637-C1B5-4462-BAF6-211512BC7A46@microsoft.com... > ...

Default Wanted -- Plain Text
I'm using Outlook 2000. It currently displays emails as HTML when the sender has used HTML. I subscribe to several listserves. I want to stop receiving HTML mail frm the lists. I want to receive plain text only. How do I do that? <*((((><{ Fishy@Ocean.Net Change your message reading format to plain text. You will not read any email in html. On the Tools menu, click Options, and then click Preferences. Click E-mail Options, and then select the Read all standard mail in plain text check box. If you just want to change only the lists format, contact the lists and request ...

Alignment for text vs numbers
If I put a literal text string ("This is a literal text string") in a cell that is too wide for that cell, the text will spill over into adjacent cells, if they are empty. However, if I put a number in that cell and then apply a custom format, like ("Results for "mm/dd/yy), it fills the cell with #'s if it's too wide. Is there a way to get the formatted number to behave like text? (Without merging cells.) If you select the cell and any empties to the right and format Center Across Selection. The full text will be displayed. Sadly, it will appear centered, but ...

Logical tests between Word form text fields
I have a Drop-Down form field with "Yes" and "No". I want to place the value 4 in a Text form field in the same document if the user selects "Yes" in the Drop-Down field. I set the Text form field to type "Calculation" but can not figure out the formula to use that doesn't return a Syntax error or "Undefined Bookmark, Yes". While I have Word 2007, I need to create this form for users with 2003 and so am using Legacy form fields. Hi jstern, Instead of using a calculation formfield, I'd suggest an ordinary formula field,...

Excel
I have exported TFS work items into Excel. This includes text that are very long, and spanning over multiple lines. Whenever I click this cell. The contents revert to hashes, making it very difficult to work with (or print) work items in Excel. I have tried formating the cell to custom format, but clicking in the cell losing this formating. Is there any way to remove the hashes? Ensure that the cell is formatted as General rather than Text, and once you have changed the format then click in that cell again, press F2 and then <enter> to ensure that the format change takes effect...