View Single Post
  #17   Report Post  
Posted to microsoft.public.word.docmanagement
Graham Mayor Graham Mayor is offline
external usenet poster
 
Posts: 19,312
Default Word 2007 Deleting across paragraphs does not delete paragraph

I agree. I have already abandoned the macro. Given the number of times I
delete text across paragraphs I can live with this anomaly.

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org




Lene Fredborg wrote:
You are right. And there is more.

Further observations:
In a protected form, deletion via the Delete key (without the macro)
works as in 2003 as far as I can see. The paragraph mark is gone
after pressing Delete.

Before I posted my macro, I tested it with tables fully or partly
selected and both with and without having selected text before or
after the table. The macro seems to work as "normal" delete (i.e.
2003 delete). I have now found out that your version fails if part of
a table is selected in combination with text before the table. And if
only part of a table is selected (without text before or after), the
result is not correct - or maybe it is better so say it this way: the
result is not the same as if one used the Delete key in 2003 or in
2007.

Another problem: even if the macro(s) were changed to handle the
above, the user would have to press Undo at least twice to undo the
deletion (unless Undo handling is also built into the macro).

All in all, I think I would skip the idea of using a macro - and then
I would prefer pressing Delete twice to overcome the problem with the
paragraph mark g


There is a snag - it doesn't work in protected form fields without
additional programming.

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org



Lene Fredborg wrote:
I found the answer via the Shortcut Key dialog box ;-)


I had been racking my brains to think what the delete key command
was - Renaming the macro works just fine

Sub EditClear()
If InStr(Selection.Text, Chr(13)) Then
Selection.Text = Replace(Selection.Text, Chr(13), " ")
End If
Selection.Delete
End Sub

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org



Lene Fredborg wrote:
Possible solution:
The command executed when pressing the Delete key is EditClear.
You could rename the deletion macro to EditClear and it will run
instead of the built-in command.


Thanks all - I have already updated my macros to replace
paragraphs marks with spaces and that does work, of course.
However, for my users, they still have the pain of having to
perform the selection delete and then delete the inserted
paragraph mark when they do this manually.

Surely, Microsoft can't believe that "delete this bit" means
"We'll delete it but add something in because you will always
need it and, no, you can't switch this off"???

Andy

"Graham Mayor" wrote:

Greg Maxey wrote:

How about:

Sub ScracthMacro()
If InStr(Selection.Text, Chr(13)) 1 Then
Selection.Text = Replace(Selection.Text, Chr(13), " ")
Selection.Delete
End If
End Sub

Sub ScratchMacro()
If InStr(Selection.Text, Chr(13)) Then
Selection.Text = Replace(Selection.Text, Chr(13), " ")
End If
Selection.Delete
End Sub

Would delete the selected text whether or not the selection
contained a paragraph break which is closer to the Word 2003
behaviour.

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org