PDA

View Full Version : TypeParagraph - Enter - determine numbers



Lucy234
03-03-2012, 03:49 AM
How to determine for certain words how many paragraphs will it be from above and how far from below?

Lets say I want a word "picture" 2 paragraphs from above text and 2 from below text, in all situations.

Thank you.

macropod
03-03-2012, 04:36 AM
Your description is ambiguous. Perhaps a wildcard Find, where:
Find = one[!^13]@[^13]{2}[!^13]@two[!^13]@[^13]{2}[!^13]@three
and the words 'one', 'two' and 'three' represent the text in the start, middle, and last paragraphs, respectively. The above Find expression assumes there is an empty paragraph between each of the find strings.

Lucy234
03-03-2012, 07:33 AM
Your description is ambiguous. Perhaps a wildcard Find, where:
Find = one[!^13]@[^13]{2}[!^13]@two[!^13]@[^13]{2}[!^13]@three
and the words 'one', 'two' and 'three' represent the text in the start, middle, and last paragraphs, respectively. The above Find expression assumes there is an empty paragraph between each of the find strings.

Ok, like this. When you press ENTER you get in another row (paragraph) right? So let's say I have a word "Cocktail" and I want that word to be TWO ENTERS from the text above, and TWO ENTERS from the text below. Assuming that there is nothing between. This is how it should look like 2 from above and 2 from below for that specific word "Cocktail".

Lucy234
03-03-2012, 07:35 AM
This is how it shouldn't look like. I don't need a function find but to fix this document so it looks like the one above. 2 ENTERS from above and 2 from below.
I can't get more specific than this.

macropod
03-03-2012, 02:20 PM
So why not simply delete all the empty paragraphs and apply appropriate paragraph Style definitions to your document? All the documents attached to your posts so far, in this thread and the others, are badly formatted, with empty paragraphs. No document needs them. Learn to use Word properly instead of asking for help to make them worse ...

fumei
03-03-2012, 02:21 PM
Again, if you used styles - like you should be doing - you would not have this problem AT ALL.

macropod
03-03-2012, 02:23 PM
Hmm, I keep hearing an echo!

fumei
03-03-2012, 04:15 PM
Yeah, sorry. I will shut up.

macropod
03-03-2012, 07:11 PM
Hi Gerry,

Please don't do that - Lucy234 seems to not want to accept what any one person tells him/her. Your reinforcement is most welcome.

Lucy234
03-03-2012, 11:08 PM
So why not simply delete all the empty paragraphs and apply appropriate paragraph Style definitions to your document? All the documents attached to your posts so far, in this thread and the others, are badly formatted, with empty paragraphs. No document needs them. Learn to use Word properly instead of asking for help to make them worse ...

I know the question is hard, hopefully someone will know the answer.

Lucy234
03-03-2012, 11:08 PM
Hi Gerry,

Please don't do that - Lucy234 seems to not want to accept what any one person tells him/her. Your reinforcement is most welcome.

It's her, thank you very much.

macropod
03-03-2012, 11:53 PM
I know the question is hard, hopefully someone will know the answer.Actually, what you're asking for is very easy to do with Find/Replace. It's also the wrong way to do it. As Gerry and I keep saying, the correct way is to use paragraph styles.

The very easy, but wrong way, with a wildcard Find/Replace is:
Find = [^13]{1,}text-to-find[^13]{1,}
Replace = ^p^p\1^p^p^p

Lucy234
03-04-2012, 12:43 AM
Actually, what you're asking for is very easy to do with Find/Replace. It's also the wrong way to do it. As Gerry and I keep saying, the correct way is to use paragraph styles.

The very easy, but wrong way, with a wildcard Find/Replace is:
Find = [^13]{1,}text-to-find[^13]{1,}
Replace = ^p^p\1^p^p^p

It doesn't work..


http://img846.imageshack.us/img846/4526/paragraphwontwork.jpg

Here is what it says..

Lucy234
03-04-2012, 02:38 AM
I tried changing "," to ";" here as well, but it still gives me the same message as above.."The replace with text contains a group number which is out of range"

macropod
03-04-2012, 02:42 AM
Correction:
Find = [^13]{1;}(text-to-find)[^13]{1;}

Lucy234
03-04-2012, 03:02 AM
Correction:
Find = [^13]{1;}(text-to-find)[^13]{1;}

Ok this works now, but I see what it does. It doesn't work in a scenario like this: you have (text-to-find) 10 paragraphs from the above text and 5 paragraphs from below text. It should be 2 from above and 1 from below, but in All cases.

I tried ur formula with 10 paragraphs from above and 1 below and it messes everything up..sometimes it even sticks with the text below with NO spacing whatsoever.

(text-to-find) should be always 2 spaces from the above text, and 1 from below.

This does not do that. I appreciate the effort though.

The file below shows how it CAN look like.

Lucy234
03-04-2012, 03:13 AM
This one shows how it SHOULD look like.

Lucy234
03-04-2012, 12:35 PM
Macropod was very close to solving this issue. Does anyone know how to complete it?

Paul_Hossler
03-04-2012, 01:09 PM
Lucy234 -- by any chance, do the 'before' versions of all those badly formatted files (in all your posts) come from an external source or from other users?

Are you just trying to 'clean them up' to a standard format?

Paul

Lucy234
03-04-2012, 02:28 PM
I just need a macro to do what I explained. It's a little complicated cause it has to take all things into consideration..

fumei
03-04-2012, 02:32 PM
It may help if you actually answered questions that are asked of you. It would be much less complicated if you used Word properly.

Paul_Hossler
03-04-2012, 03:31 PM
I just need a macro to do what I explained. It's a little complicated cause it has to take all things into consideration..



:banghead: :banghead:

Ok, I'll let the other members try to help

macropod
03-04-2012, 08:39 PM
It doesn't work in a scenario like this: you have (text-to-find) 10 paragraphs from the above text and 5 paragraphs from below text. It should be 2 from above and 1 from below, but in All cases.

I tried ur formula with 10 paragraphs from above and 1 below and it messes everything up..sometimes it even sticks with the text below with NO spacing whatsoever.
From what you've posted in your attachments, I can see no basis for your claim that the Find/Replace 'messes everything up' or that it ''. In any event, the only change I can see that is warranted on the basis of your latest attachments is a minor variation of the Replace expression:
Replace = ^p^p^p\1^p^p
I'm surprised you couldn't work that much out for yourself.

Of course, if you have a string to found and that isn't preceded by any empty paragraphs, that instance won't be found. Neither will it process correctly any instances where all the unwanted preceding paragraphs aren't completely empty. As your samples haven't suggested that possibility, I haven't bothered coding for it.

Lucy234
03-04-2012, 11:02 PM
I have a string to find which maybe isn't preceded by any empty paragraphs. It also has to correct instances where all the unwanted preceding paragraphs aren't completely empty. Taking all above things into consideration as well.

fumei
03-05-2012, 12:51 AM
If the preceding paragraphs are NOT empty, what do you want to happen to them? Please give a real specific example. All your examples are empty paragraphs. So...show us an example of when there IS text, and what EXACTLY you want to happen.

The only way you can get what you want (whatever that is) is to clearly determine what the rules are.

You state "maybe". You must determine EXACTLY what happens if there is, and what happens if there is NOT. YOU have to do that. Maybe is simply not good enough.

macropod
03-05-2012, 02:25 AM
Correction and clarification: Instead of my reference to "any empty paragraphs", read "any paragraphs" (ie it won't work if the string is the first paragraph in the document). In any case it will work. However, if you have, say:

The quick brown fox jumps over the lazy dog.¶



Find Text¶
The quick brown fox jumps over the lazy dog.¶
then the 'find' isn't going to look any further forward than the paragraph with ' ¶' and you'll end up with:

The quick brown fox jumps over the lazy dog.¶



Find Text¶

The quick brown fox jumps over the lazy dog.¶
Now, if you can say what spurious characters might be in the paragraphs you want to delete, I might be able to provide a Find expression to deal with them. Just don't expect miracles.

And please, when you say you want a problem fixed, take the time to say what the problem is. Your continual responses with 'it doesn't work' because you haven't bothered to tell us all of what the issues are is really getting tiring. All you're achieving is aggravation and time-wasting. Keep it up and soon, no-one will bother responding.

Frosty
03-05-2012, 10:02 AM
All you're achieving is aggravation and time-wasting. Keep it up and soon, no-one will bother responding. Lucy234,

It is very odd that you are so demanding and rude when you are getting expert problem solving for free.

Based on your responses to fumei, macropod and Paul_Hossler (who are all long-time, extremely helpful, knowledgeable and more-patient-than-me posters) in this thread and the others, I am already in the camp of someone who wouldn't bother responding to a thread by you. Obviously it's easy enough to change a screen name. But I would try to change your attitude too.

Lucy234
03-05-2012, 11:46 PM
Correction and clarification: Instead of my reference to "any empty paragraphs", read "any paragraphs" (ie it won't work if the string is the first paragraph in the document). In any case it will work. However, if you have, say:

The quick brown fox jumps over the lazy dog.¶



Find Text¶
The quick brown fox jumps over the lazy dog.¶
then the 'find' isn't going to look any further forward than the paragraph with ' ¶' and you'll end up with:

The quick brown fox jumps over the lazy dog.¶



Find Text¶

The quick brown fox jumps over the lazy dog.¶
Now, if you can say what spurious characters might be in the paragraphs you want to delete, I might be able to provide a Find expression to deal with them. Just don't expect miracles.

And please, when you say you want a problem fixed, take the time to say what the problem is. Your continual responses with 'it doesn't work' because you haven't bothered to tell us all of what the issues are is really getting tiring. All you're achieving is aggravation and time-wasting. Keep it up and soon, no-one will bother responding.

Your example has "Find Text" 3 from above and 1 from below paragraph. That "Find Text" has to be always 2 from above and 1 from below. It is always alone between two texts. It doesn't have to be extracted from the text. It's always alone in the row. I can't get more specific than this.

Lucy234
03-05-2012, 11:47 PM
The quick brown fox jumps over the lazy dog.¶


Find Text¶

The quick brown fox jumps over the lazy dog.¶

It has too look like this. 2 from above, one from below. That FIND TEXT will always be alone in it's row.

macropod
03-06-2012, 12:22 AM
Your example has "Find Text" 3 from above and 1 from below paragraph. That "Find Text" has to be always 2 from above and 1 from below. It is always alone between two texts. It doesn't have to be extracted from the text. It's always alone in the row. I can't get more specific than this.
The conversion you say you want is exactly what you get with the wildcard Find/Replace I've already given you:
Find = [^13]{1;}(text-to-find)[^13]{1;}
Replace = ^p^p^p\1^p^p
Of course, this will only work if there are no characters (including spaces & tabs) other than paragraph marks before and after the 'text-to-find'. And so far, you haven't indicated that it's anything other than this. So, if you're not getting the right results, it only shows (once again), that you haven't told us the full story.

Lucy234
03-06-2012, 10:00 AM
The conversion you say you want is exactly what you get with the wildcard Find/Replace I've already given you:
Find = [^13]{1;}(text-to-find)[^13]{1;}
Replace = ^p^p^p\1^p^p
Of course, this will only work if there are no characters (including spaces & tabs) other than paragraph marks before and after the 'text-to-find'. And so far, you haven't indicated that it's anything other than this. So, if you're not getting the right results, it only shows (once again), that you haven't told us the full story.



xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx






Angel

















xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx


Try using ur formula in this case.

Talis
03-06-2012, 11:20 AM
Lucy, the example you give does not have blank lines above and below the word 'Angel'. Each line has a space before the paragraph return. You can see these if you turn on 'show hidden characters' by clicking the pilcrow in the toolbar. It looks like this: ¶, and you will see a dot before each ¶. The dot represents a 'space'.

So before applying Macropod's Find/Replace you should remove these spaces using:

Find: <space>^13
Replace: ^p
Where <space> means type a 'space'.

It appears to me that you have scans or PDFs or downloads that you have moved into Word to modify and intend to Save as text files. This is why you don't want to use Styles which are not preserved in a text file.
Maybe the purpose is to create something to load into an eReader?
Anyway, if you give some indication of what you are doing you will get much better advice.
I enjoy reading your threads but I suspect you have given the experts a few more grey hairs!

Lucy234
03-06-2012, 12:14 PM
Lucy, the example you give does not have blank lines above and below the word 'Angel'. Each line has a space before the paragraph return. You can see these if you turn on 'show hidden characters' by clicking the pilcrow in the toolbar. It looks like this: ¶, and you will see a dot before each ¶. The dot represents a 'space'.

So before applying Macropod's Find/Replace you should remove these spaces using:

Find: <space>^13
Replace: ^p
Where <space> means type a 'space'.

It appears to me that you have scans or PDFs or downloads that you have moved into Word to modify and intend to Save as text files. This is why you don't want to use Styles which are not preserved in a text file.
Maybe the purpose is to create something to load into an eReader?
Anyway, if you give some indication of what you are doing you will get much better advice.
I enjoy reading your threads but I suspect you have given the experts a few more grey hairs!

Thank you. That partially solves the issue, but still macropod's code is not good. Sometimes it works, sometimes it doesn't. Sometimes I have to click it twice in order to work. The word "Angel" was the first word in a row, so no spaces before, even though your suggestion will be useful in the future for sure. :)
You are close regarding my reasons to modify a text like this.

It's too complicated to write a VBA program so I was offered with just find/replace as a poor and simple substitute. I never said this was easy, but if one doesn't know how, Christ, just say so..I don't know Anything in VBA..so you are all experts for me..

fumei
03-06-2012, 12:48 PM
"Anyway, if you give some indication of what you are doing you will get much better advice.|

Lucy, why do you not actually try and help yourself and answer reasonable questions. You ignore just about everything people ask. We are not asking things just for our amusement. We are trying to help.

I am done. I will not answer anything you ever ask. Frankly, you do not deserve it. Basically it comes down to that if you ignore me...then I shall ignore you.

VBA is extremely powerful but if you have crap (which you do) it can not do everything. It can not, and never will, be able to handle random crap.

macropod
03-06-2012, 04:44 PM
Thank you. That partially solves the issue, but still macropod's code is not good. Sometimes it works, sometimes it doesn't.
...

It's too complicated to write a VBA program so I was offered with just find/replace as a poor and simple substitute. I never said this was easy, but if one doesn't know how, Christ, just say so..
Lucy. You really know how to be offensive, don't you!!!

You say my Find/Replace is not good, when in fact it does exactly what you asked. The real issue is that you haven't bothered describing the issue properly. So, the problem is located between your computer and chair. That's right, it's YOU! It's not a problem with Find/replace or difficulties with VBA. As I said in post #12:

what you're asking for is very easy to do with Find/Replace
If I were to write a macro to do this (and I can), it would simply be one that executes the very same Find/Replace action. But, since you keep saying it doesn't work properly - without saying what the issue is - why would I (or anyone else) bother?

So, now you feel the need to blaspheme as if that'll earn brownie points. Not with me it won't.

Lucy234
03-06-2012, 10:30 PM
Lucy. You really know how to be offensive, don't you!!!

You say my Find/Replace is not good, when in fact it does exactly what you asked. The real issue is that you haven't bothered describing the issue properly. So, the problem is located between your computer and chair. That's right, it's YOU! It's not a problem with Find/replace or difficulties with VBA. As I said in post #12:

If I were to write a macro to do this (and I can), it would simply be one that executes the very same Find/Replace action. But, since you keep saying it doesn't work properly - without saying what the issue is - why would I (or anyone else) bother?

So, now you feel the need to blaspheme as if that'll earn brownie points. Not with me it won't.

Using your find/replace button, on your own example does not work properly. It works alright, but not every time I use it and I repeat, on the same old example. If it's 10 from above and 5 from below and I use it, sometimes I get 2 from above and 2 from below (should be 1 below). When I use it on 10 from above and 1 from below, I get 15 from above and it gets sticked to the row below with no free space between, etc. The only difference I was making was the number of paragraphs from the upper text and the text below, that's it.

Besides, I was not offensive, nobody knows Everything..

Frosty
03-07-2012, 07:16 AM
You are offensive. I'm beginning to think you are either a child or English is not your primary language, since you seem unable to grasp nuance.

I would suggest you pay someone to do this work for you. Everything you've described is quite easy to solve. The problem in solving it is not the degree of difficulty, it is some combination of your attitude and/or inability to give good information.

Despite numerous people saying the same thing, you continually believe you are not getting your problem solved because it is difficult.

I've only watched this thread out of some fascination with the train wreck, but not out of any desire to help you, after the way you've come across in this thread.

In short: it's not us, it's you.

Maybe Lucy235 will be nicer, and more appropriately thankful to the FREE help she is getting from people who are generally paid for the same type of work?

Lucy234
03-07-2012, 11:16 AM
You are offensive. I'm beginning to think you are either a child or English is not your primary language, since you seem unable to grasp nuance.

I would suggest you pay someone to do this work for you. Everything you've described is quite easy to solve. The problem in solving it is not the degree of difficulty, it is some combination of your attitude and/or inability to give good information.

Despite numerous people saying the same thing, you continually believe you are not getting your problem solved because it is difficult.

I've only watched this thread out of some fascination with the train wreck, but not out of any desire to help you, after the way you've come across in this thread.

In short: it's not us, it's you.

Maybe Lucy235 will be nicer, and more appropriately thankful to the FREE help she is getting from people who are generally paid for the same type of work?

You should drink a glass of cold water. That usually calms down people..You are a good person, but very ill tempered..

Paul_Hossler
03-07-2012, 12:01 PM
You should drink a glass of cold water. That usually calms down people..You are a good person, but very ill tempered..


Unfortunately, since you've consistantly refused to take our advice and suggestions, I doubt if anyone will feel any pressing need to take your .... advice


Paul

Talis
03-07-2012, 12:06 PM
Lucy please be careful in what you post. This isn't Facebook where you can sound off against other members, especially the people who are freely donating their time to help you. To get to their expert level has taken years of dedicated study. Respect them as you would a teacher and be thankful they have been willing to assist you in what are really rather trivial problems.

Lucy234
03-07-2012, 10:33 PM
Lucy please be careful in what you post. This isn't Facebook where you can sound off against other members, especially the people who are freely donating their time to help you. To get to their expert level has taken years of dedicated study. Respect them as you would a teacher and be thankful they have been willing to assist you in what are really rather trivial problems.

Oh all right, but I wasn't talking about macropod anyway, he was helpful, but this character "fumei". From the beginning he was just criticizing me and offering no explanation whatsoever, not even the find/replace stuff. Obviously macropod knows more about VBA than fumei, but if this was all trivial then even fumei could've offered some sort of answers..

Paul_Hossler
03-08-2012, 06:40 AM
Oh all right, but I wasn't talking about macropod anyway, he was helpful, but this character "fumei". From the beginning he was just criticizing me and offering no explanation whatsoever, not even the find/replace stuff. Obviously macropod knows more about VBA than fumei, but if this was all trivial then even fumei could've offered some sort of answers..


OK .. everyone stop and take some deep breaths, drink some water, eat a chocolate.

:100:


Paul