![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | Getting Word Paragraph Number Hi All, I have a written a vbscript which will search for some text in a word document and if a match is found then, that paragraph will be written to another word file or text file. I was able to acheive this but the problem is I dont know how to get the paragraph number where the match is found. Can anyone tell me how to get the current paragraph number. Thanks in advance. |
My System Specs![]() |
| | #2 (permalink) |
| | Re: Getting Word Paragraph Number Codeblack wrote: Quote: > I have a written a vbscript which will search for some text in a word > document and if a match is found then, that paragraph will be written to > another word file or text file. I was able to acheive this but the problem is > I dont know how to get the paragraph number where the match is found. > I have never done this, but here is a suggestion (call it a "brute force" approach). Try using the "Paragraphs Object". That is a property of your (word) document. It will return a "collection" of paragraphs in the document. Then "restructure" your search. Use the For...Next approach to go through the document paragraph-by-paragraph, and select each paragraph. Then search for your key phrase WITHIN THE SELECTION (i.e., just the current paragraph, not in the entire document). When you find a hit, then you know the paragraph number -- it would be the index of the paragraph you are working on. cheers, jw ____________________________________________________________ You got questions? WE GOT ANSWERS!!! ..(but, no guarantee the answers will be applicable to the questions) |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Line spacing (paragraph separation) fails sometimes | Live Mail | |||
| New line in stead of new paragraph | VB Script | |||
| When I type the words skip to previous paragraph | Vista General | |||
| Number of copies using Word 2007 | Vista print fax & scan | |||