Make "Selection.TypeParagraph" work if text, not work if just

Make "Selection.TypeParagraph" work if text, not work if just

Post by TmV0Q29 » Sun, 19 Oct 2008 05:08:09


oy. It's a HUGE macro that I am trying to modify. The part i need to modify
was written to insert a paragraph after a subhead in a file that did not
start out with a paragraph after a subhead.

I still need it to do that, but I now also need it to _not_ insert a
paragraph after a subhead in a file that starts out with a paragraph after a
subhead.

I was told by my Powers That Be to replace "Selection.TypeParagraph"
with
Selection.MoveRight Unit:=wdCharacter, Count:=1, Extend:=wdExtend
If Selection.Text <> " " Then
Selection.MoveLeft Unit:=wdCharacter, Count:=1
Selection.TypeParagraph
Else
Selection.MoveLeft Unit:=wdCharacter, Count:=1
End If

but the paragraph mark is still added, resulting in 2 paragraph marks.

I am thinking that it can't be done without totally changing the existing
macro and I am not empowered to do that or to get it done.

I was just hoping beyond hope that it was just a tweak or a misplaced
something in this little code snippet that could be fixed or whatever and
then it would work.

thank you for your time.
 
 
 

Make "Selection.TypeParagraph" work if text, not work if just

Post by Doug Robbi » Sun, 19 Oct 2008 15:49:06

And precisely what do you mean by the term "subhead"? It is not a defined
term in Word. Is it a particular Heading Style and what you want to do is
insert an empty paragraph if it is followed immediately by a paragraph with
the same Heading Style.

And do you actually want an empty paragraph or is what you are really trying
to do is have the paragraph that has the Heading Style appear with some
space after it.

And where you do not want to insert a paragraph (in your terms" _not_insert
a paragraph") is that because there is already and empty paragraph after
that Heading Style and before the next paragraph containing text.

If you want help that is of use to you, you must tell us, in meaningful
terms, and by that I mean in terms such as those that are used Word, exactly
what it is that you have and exactly what it is that you want to have.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP