PDA

View Full Version : Replacing section mark



Snowflake
10-16-2012, 02:44 PM
How to replace a section mark with space, but only if there is some text written before it?

"^p" to replace with "space".

Example 1:

^p
^p
^p
^p
The moon is shining.^p
it could be but^p
not sure
^p
^p

So only "^p" which has something written before would get replaced with "space".

Many thanks to everyone! :content:

Paul_Hossler
10-16-2012, 03:27 PM
Section mark or paragraph mark?

The ^p 's are paragraph marks

There is a section break but that's different

Paul

fumei
10-16-2012, 03:28 PM
So you want?

^p
^p
^p
^p ^p ^p
not sure ^p
^p

Snowflake
10-16-2012, 09:49 PM
Section mark or paragraph mark?

The ^p 's are paragraph marks

There is a section break but that's different

Paul

Paragraph marks then. :)

Snowflake
10-16-2012, 09:54 PM
So you want?

^p
^p
^p
^p ^p ^p
not sure ^p
^p

I want this:
^p
^p
^p
^p
The moon is shining.^p
it could be but^p
not sure
^p
^p

to become this:

^p
^p
^p
^p
The moon is shining. it could be but not sure
^p
^p

So only the bold ones would get replaced by space.

gmaxey
10-17-2012, 04:46 AM
Snowflake,

Sub ScratchMacro()
'A quick macro scratch pad created by Greg Maxey
Dim oRng As Word.Range
Set oRng = ActiveDocument.Range
With oRng.Find
.Text = "([!^13])^13([!^13])"
.Replacement.Text = "\1 \2"
.MatchWildcards = True
.Execute Replace:=wdReplaceAll
End With

End Sub


There is an old sage "Give an man and he eats for a day. Teach a man to fish and he eats for a lifetime."

Speaking only for myself, I have given you your last fish and feel that it is time for you to start demonstrating that you are making some effort to learn to do these tasks on your own. I'll be happy to help, but you need to post what you have tried.

Snowflake
10-17-2012, 09:12 AM
Thank you thank you thank you!!! :)

gmaxey
10-17-2012, 09:51 AM
That was supposed to be "give a man a fish"

I really wish this forum would allow editing the posts for an indefinate period of time. It is bad enough that I am prone to error, knowing about them and being force to let them remain stinks.

fumei
10-17-2012, 06:28 PM
Poor Greg.

Snowflake, why do have a document with all those "empty" paragraphs?

Snowflake
10-17-2012, 10:06 PM
Poor Greg.

Snowflake, why do have a document with all those "empty" paragraphs?


I don't know..Word is unpredictable..

gmaxey
10-18-2012, 04:47 AM
Gerry,

A little support would be nice. No? Do you see a point in restricting editing of posts after 5 hours (was 60 minutes)?

If something posted is incorrect or should be modified after 4 hours and fifty-nine minutes, what changes at 5 hours? The clock may have changed, but the post is still incorrect and should be modified.

I can understand and accept policies, if they have a purpose. I don't see one in this case. If you do then please enlighten me and help me understand why that purpose overrides accuracy.

Thanks.


Poor Greg.

Snowflake, why do have a document with all those "empty" paragraphs?

fumei
10-18-2012, 11:53 AM
Greg, sorry, I was not being unsympathetic. Quite the opposite in fact. I utterly TOTALLY support your position. Darn text without smiling context...

I think unlimited editing should be the starting position. I can, though, see some point in restricting editing at some point, but that point IMO should be determined by consensus not fiat.

So sorry again. I really DO agree with you. The "poor Greg" was me being sympathetic. Darn text without smiling context...

:hi::hi::hi::hi::hi::hi::hi::hi::hi::hi::hi::hi::hi::hi::hi::hi::hi::hi:

Snowflake: "I don't know..Word is unpredictable.."

Huh? Are you serious? In this regard Word is utterly predictable. It did not put ANYTHING in there. Nothing. Zip. Nada.

YOU did! (Or whoever produced the document.) I know of nothing whatsoever in Word that would produce empty paragraphs on its own. YOU put them in. Do not blame Word for it - that is nonsense.

I have produced thousands of documents, and not a single one has a single empty paragraph.

gmaxey
10-18-2012, 12:11 PM
Gerry,

Actually I suspected innuedo in that remark, and was only hoping to inspire an explicit statement of support with my reply.

Thanks Gullable. I mean Gerry ;-)

fumei
10-18-2012, 01:13 PM
Damn it, suckered AGAIN. I really am gullable. Between you and Paul I am looking like an naive idiot.