PDA

View Full Version : [SOLVED:] Find the paragraph between Question 1 and Question 2?



khoav2k
01-31-2021, 03:00 AM
Before
Question 1. What your name ?
A. My name Kh. B. My name T
C. My name Q D. My name G
Question 2. How are you?
A. I'm fine.
B. I'm cold
C. I'm hot
D. I'm so so.
I want ...
After
Question 1. What your name ?
A. My name Kh. B. My name T
C. My name Q D. My name G
Tks

macropod
01-31-2021, 03:57 AM
Your Before & After for Question 1 look the same to me. To reformat all questions as per Question 1 you could use a wildcard Find/Replace, where:
Find = (Question [0-9]*\?^13A. *)^13(B. *^13C. *)^13(D. *^13)
Replace = \1 \2 \3
Alternatively, if you simply want to delete Questions formatted like Question 2, simply leave the Replace expression empty.

khoav2k
01-31-2021, 05:03 AM
please detail !


Your Before & After for Question 1 look the same to me. To reformat all questions as per Question 1 you could use a wildcard Find/Replace, where:
Find = (Question [0-9]*\?^13A. *)^13(B. *^13C. *)^13(D. *^13)
Replace = \1 \2 \3
Alternatively, if you simply want to delete Questions formatted like Question 2, simply leave the Replace expression empty.




My idea, take question 1, then copy it to another page! Tks

macropod
01-31-2021, 01:19 PM
Well, that isn't what your first post asked!

Kindly explain exactly what you're trying do achieve. After all, what you're now saying can be dome by simply copying & pasting Question 1 and its answers.

khoav2k
01-31-2021, 07:15 PM
What i want is format all
Question....
After
Question 1. What your name ?
A. My name Kh.
B. My name T
C. My name Q
D. My name G
Question 2. How are you?
A. I'm fine.
B. I'm cold
C. I'm hot
D. I'm so so.
(Poor English hope for sympathy)

macropod
01-31-2021, 07:57 PM
That really does not address what I wrote in post #4.

Now, however, your Question 1 and its answers are formatted differently from what they were in Post #1.

I still have no idea what you're trying to achieve.

khoav2k
01-31-2021, 09:22 PM
That really does not address what I wrote in post #4.

Now, however, your Question 1 and its answers are formatted differently from what they were in Post #1.

I still have no idea what you're trying to achieve.

So Sorry, i want format all question same this
Before
Question 1. What your name ?
A. My name Kh. B. My name T
C. My name Q D. My name G
Question 2. How are you?
A. I'm fine.
B. I'm cold
C. I'm hot
D. I'm so so.
Questio 3. Whers are you from?
A. Answer 1. B. Answer 2 C. Answer 3 D. Answer 4

After
Question 1. What your name ?
A. My name Kh.
B. My name T
C. My name Q
D. My name G
Question 2. How are you?
A. I'm fine.
B. I'm cold
C. I'm hot
D. I'm so so.
Questio 3. Whers are you from?
A. Answer 1.
B. Answer 2
C. Answer 3
D. Answer 4

Help me! Tks

macropod
01-31-2021, 10:36 PM
To reformat all questions as per Question 2 you could use a wildcard Find/Replace, where:
Find = (Question [0-9]*\?^13A. *)[ ^13](B. *)[ ^13](C. *)[ ^13](D. *^13)
Replace = \1^p\2^p\3^p\4

khoav2k
02-01-2021, 06:08 AM
To reformat all questions as per Question 2 you could use a wildcard Find/Replace, where:
Find = (Question [0-9]*\?^13A. *)[ ^13](B. *)[ ^13](C. *)[ ^13](D. *^13)
Replace = \1^p\2^p\3^p\4
help!

Sub Macro()
With ActiveDocument.Content.Find
.ClearFormatting
.Replacement.ClearFormatting
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchWildcards = True
.Text = "(Question [0-9]*\?^13A. *)[ ^13](B. *)[ ^13](C. *)[ ^13](D. *^13)"
.Replacement.Text = "\1^p\2^p\3^p\4"
.Execute Replace:=wdReplaceAll
End With
End Sub

macropod
02-01-2021, 01:55 PM
Help with what? The F/R works on the sample text in post #7.

khoav2k
02-01-2021, 05:40 PM
Help with what? The F/R works on the sample text in post #7.

Code no run

macropod
02-02-2021, 12:56 AM
Your code works for me...