Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

search document 1

Status
Not open for further replies.

cramd

Programmer
Mar 28, 2001
214
US
I need to search a document for double paragraph markings (^p^p) and each time I find this, I need to keep track of the ^p^p position. I intend to add the position to an array, and I want to keep this search in a loop--but I'm not sure how I will know I'm at the end of page-- example:
DO
execute find 'find all ^p^p
if find.found = true
iPosition(i) = wdLine
end if
LOOP until end of page??

Also, when the find is true, I grab the wdLine information to hold my position of the ^p^p--is this correct or would there be a better way of handling this? Any thoughts would be appreciated.

cramd
 
How do you intend to use the information when you're done storing it? wdLine is a constant - it's of no use to you in this context, but you can use other measures of position, depending how you will be using it.
Rob
[flowerface]
 
Rob,
I did this once before, -- you think I would learn. I thought wdLine gave me the line position of my find ^p^p, I'm still learning......

I have documents that I need to delete the single paragraph marking (^p) but I want to make sure I don't delete out any ^p^p markings. My thought is to find all positions that have ^p^p, store the position in an array, then I need to search for ^p marks, search the array to make sure the position is not listed and then delete........

cramd
 
A much easier way about that is to first do a search and replace for ^P^P, replacing with "{double paragraph}". Then search and replace for ^P, replacing with nothing (or a space). Then search and replace for "{double paragraph}", replacing with ^P^P. Let the Word document itself keep track of things for you!
Rob
[flowerface]
 
Rob,
Your solution was much easier than what I had intended to do; I tested it and it works great! Just curious though, any quick hints of advise as to the finding of a cursor position; such as when "find.found = true" and I need to know the cursor position, what is the best way?

Thank you for your interest in my post!

cramd
 
Check out the kind of obscure property selection.information. For example,

selection.Information(wdFirstCharacterLineNumber)

gives you the line number of the selection point.
Rob
[flowerface]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top