Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Word 2007 Deleting across paragraphs does not delete paragraph mar
If I select from the middle of one paragraph to the middle of another
paragraph and then press Delete, I expect selection to be removed and the remaining parts of the paragraphs to be merged into one. However, Word 2007 removes the text but inserts a paragraph mark to leave me with two paragraphs still. This is not how it used to be and not what I want it to be but I can not find a way to stop it doing this. It's bad enough to have to manually delete the new paragraph mark, but we have many hundreds of templates controlled by macros that are being badly affected by this. How do I stop Word inserting a paragraph mark? |
#2
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Word 2007 Deleting across paragraphs does not delete paragraph mar
There are a number of "smart" options that you might experiment with to see
which one might be causing this behavior. In Office Button | Word Options | Advanced: Cut, copy, and paste, look at the settings for "Smart cut and paste." Under "Editing options," I found that I had to disable "Use smart paragraph selection," but I don't remember why. FWIW, when I select parts of two successive paragraphs and delete them, the selection is deleted, but the text remains in two paragraphs, so whatever I have done so far hasn't solved the problem you describe. And this *is* a change from Word 2003. -- Suzanne S. Barnhill Microsoft MVP (Word) Words into Type Fairhope, Alabama USA http://word.mvps.org "ATD" wrote in message news If I select from the middle of one paragraph to the middle of another paragraph and then press Delete, I expect selection to be removed and the remaining parts of the paragraphs to be merged into one. However, Word 2007 removes the text but inserts a paragraph mark to leave me with two paragraphs still. This is not how it used to be and not what I want it to be but I can not find a way to stop it doing this. It's bad enough to have to manually delete the new paragraph mark, but we have many hundreds of templates controlled by macros that are being badly affected by this. How do I stop Word inserting a paragraph mark? |
#3
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Word 2007 Deleting across paragraphs does not delete paragraph mar
I had not registered that strange and new behavior until reading your post. I
have not yet registered problems with any of my huge amount of macros due to this but this could very easily happen. I agree with you that one expects the selection to be totally deleted when one selects Delete (as it works in previous versions of Word). The behavior could be €śby design€ť €“ e.g. to preserve the applied paragraph styles. I cannot find any built-in options that change the way it works. In macros containing code to delete content that spans two or more paragraphs without necessarily including the entire first and last paragraphs, the only solution I can think of now is to treat the deletion via special macro code (the problem with the left over paragraph mark applies no matter whether you use Selection or Range when deleting). The following macro should delete the remaining paragraph mark together with the remainder of the selection (I have tried to make the macro so that it will not make any harm if used in earlier versions of Word): Sub DeleteEntireSelection_Word2007() Dim oRange As Range Dim nParas As Long Dim bFirstParaIncluded As Boolean Dim bLastParaIncluded As Boolean Set oRange = Selection.Range With oRange nParas = .Paragraphs.Count 'Find out whether entire first and last paragraph is in selection bFirstParaIncluded = ..Paragraphs.First.Range.Characters.First.InRange( oRange) bLastParaIncluded = ..Paragraphs.Last.Range.Characters.Last.InRange(oR ange) .Delete 'In case of Word 2007: 'If original selection spans more than 1 paragraph 'and if entire first and last paragraphs are not in the selection, 'a paragraph mark is left - delete it If Val(Application.Version) 11 Then 'Only needed to check if more than one paragraph is selected If nParas 1 Then If bFirstParaIncluded = False And bLastParaIncluded = False Then Selection.Characters(1).Delete End If End If End If End With 'Clean up Set oRange = Nothing End Sub -- Regards Lene Fredborg - Microsoft MVP (Word) DocTools - Denmark www.thedoctools.com Document automation - add-ins, macros and templates for Microsoft Word "ATD" wrote: If I select from the middle of one paragraph to the middle of another paragraph and then press Delete, I expect selection to be removed and the remaining parts of the paragraphs to be merged into one. However, Word 2007 removes the text but inserts a paragraph mark to leave me with two paragraphs still. This is not how it used to be and not what I want it to be but I can not find a way to stop it doing this. It's bad enough to have to manually delete the new paragraph mark, but we have many hundreds of templates controlled by macros that are being badly affected by this. How do I stop Word inserting a paragraph mark? |
#4
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Word 2007 Deleting across paragraphs does not delete paragraphmar
On Jun 12, 8:42*pm, Lene Fredborg
wrote: I had not registered that strange and new behavior until reading your post. I have not yet registered problems with any of my huge amount of macros due to this but this could very easily happen. I agree with you that one expects the selection to be totally deleted when one selects Delete (as it works in previous versions of Word). The behavior could be “by design” – e.g.. to preserve the applied paragraph styles. I cannot find any built-in options that change the way it works. In macros containing code to delete content that spans two or more paragraphs without necessarily including the entire first and last paragraphs, the only solution I can think of now is to treat the deletion via special macro code (the problem with the left over paragraph mark applies no matter whether you use Selection or Range when deleting). The following macro should delete the remaining paragraph mark together with the remainder of the selection (I have tried to make the macro so that it will not make any harm if used in earlier versions of Word): Sub DeleteEntireSelection_Word2007() * * Dim oRange As Range * * Dim nParas As Long * * Dim bFirstParaIncluded As Boolean * * Dim bLastParaIncluded As Boolean * * Set oRange = Selection.Range * * With oRange * * * * nParas = .Paragraphs.Count * * * * 'Find out whether entire first and last paragraph is in selection * * * * bFirstParaIncluded = .Paragraphs.First.Range.Characters.First.InRange(o Range) * * * * bLastParaIncluded = .Paragraphs.Last.Range.Characters.Last.InRange(oRa nge) * * * * .Delete * * * * 'In case of Word 2007: * * * * 'If original selection spans more than 1 paragraph * * * * 'and if entire first and last paragraphs are not in the selection, * * * * 'a paragraph mark is left - delete it * * * * If Val(Application.Version) 11 Then * * * * * * 'Only needed to check if more than one paragraph is selected * * * * * * If nParas 1 Then * * * * * * * * If bFirstParaIncluded = False And bLastParaIncluded = False Then * * * * * * * * * * Selection.Characters(1).Delete * * * * * * * * End If * * * * * * End If * * * * End If * * End With * * 'Clean up * * Set oRange = Nothing End Sub -- Regards Lene Fredborg - Microsoft MVP (Word) DocTools - Denmarkwww.thedoctools.com Document automation - add-ins, macros and templates for Microsoft Word "ATD" wrote: If I select from the middle of one paragraph to the middle of another paragraph and then press Delete, I expect selection to be removed and the remaining parts of the paragraphs to be merged into one. *However, Word 2007 removes the text but inserts a paragraph mark to leave me with two paragraphs still. *This is not how it used to be and not what I want it to be but I can not find a way to stop it doing this. *It's bad enough to have to manually delete the new paragraph mark, but we have many hundreds of templates controlled by macros that are being badly affected by this. How do I stop Word inserting a paragraph mark?- Hide quoted text - - Show quoted text - 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 |
#5
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Word 2007 Deleting across paragraphs does not delete paragraph mar
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 |
#6
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Word 2007 Deleting across paragraphs does not delete paragraph
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 |
#7
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Word 2007 Deleting across paragraphs does not delete paragraph
Hi Greg and Graham,
Much easier and much better to do it in that order€¦ -- Regards Lene Fredborg - Microsoft MVP (Word) DocTools - Denmark www.thedoctools.com Document automation - add-ins, macros and templates for Microsoft Word "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 |
#8
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Word 2007 Deleting across paragraphs does not delete paragraph
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. -- Regards Lene Fredborg - Microsoft MVP (Word) DocTools - Denmark www.thedoctools.com Document automation - add-ins, macros and templates for Microsoft Word "ATD" wrote: 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 |
#9
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Word 2007 Deleting across paragraphs does not delete paragraph
Whether this is 'by design' I cannot say, but here is a certain logic in it.
The formatting associated with a paragraph is stored in the paragraph break. By retaining that paragraph break the formatting of the two parts is retained. There is less 'pain' if instead of pressing 'delete' or 'backspace', the users press 'space' then 'backspace'. -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org ATD wrote: 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 |
#10
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Word 2007 Deleting across paragraphs does not delete paragraph
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 |
#11
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Word 2007 Deleting across paragraphs does not delete paragraph
I found the answer via the Shortcut Key dialog box ;-)
-- Regards Lene Fredborg - Microsoft MVP (Word) DocTools - Denmark www.thedoctools.com Document automation - add-ins, macros and templates for Microsoft Word "Graham Mayor" wrote: 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 |
#12
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Word 2007 Deleting across paragraphs does not delete paragraph
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 |
#13
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Word 2007 Deleting across paragraphs does not delete paragraphmar
If you place your cursor at the end of a word, then select text to the
immediate left of a word in the next paragraph, you can hit the spacebar instead of the delete key. This keeps the spacing correct without a paragraph mark and no need for a macro. Cheryl On Jun 12, 6:53*am, ATD wrote: If I select from the middle of one paragraph to the middle of another paragraph and then press Delete, I expect selection to be removed and the remaining parts of the paragraphs to be merged into one. *However, Word 2007 removes the text but inserts a paragraph mark to leave me with two paragraphs still. *This is not how it used to be and not what I want it to be but I can not find a way to stop it doing this. *It's bad enough to have to manually delete the new paragraph mark, but we have many hundreds of templates controlled by macros that are being badly affected by this. How do I stop Word inserting a paragraph mark? |
#14
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Word 2007 Deleting across paragraphs does not delete paragraph mar
Indeed, this does work and may be the only satisfactory solution.
-- Suzanne S. Barnhill Microsoft MVP (Word) Words into Type Fairhope, Alabama USA http://word.mvps.org "Cheryl Flanders" wrote in message ... If you place your cursor at the end of a word, then select text to the immediate left of a word in the next paragraph, you can hit the spacebar instead of the delete key. This keeps the spacing correct without a paragraph mark and no need for a macro. Cheryl On Jun 12, 6:53 am, ATD wrote: If I select from the middle of one paragraph to the middle of another paragraph and then press Delete, I expect selection to be removed and the remaining parts of the paragraphs to be merged into one. However, Word 2007 removes the text but inserts a paragraph mark to leave me with two paragraphs still. This is not how it used to be and not what I want it to be but I can not find a way to stop it doing this. It's bad enough to have to manually delete the new paragraph mark, but we have many hundreds of templates controlled by macros that are being badly affected by this. How do I stop Word inserting a paragraph mark? |
#15
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Word 2007 Deleting across paragraphs does not delete paragraph
That is true. However, users are used to press Delete to delete something and
you may not always need to delete entire words. You would then need to press Backspace afterwards to delete the space (Graham suggested that procedure too). -- Regards Lene Fredborg - Microsoft MVP (Word) DocTools - Denmark www.thedoctools.com Document automation - add-ins, macros and templates for Microsoft Word "Cheryl Flanders" wrote: If you place your cursor at the end of a word, then select text to the immediate left of a word in the next paragraph, you can hit the spacebar instead of the delete key. This keeps the spacing correct without a paragraph mark and no need for a macro. Cheryl On Jun 12, 6:53 am, ATD wrote: If I select from the middle of one paragraph to the middle of another paragraph and then press Delete, I expect selection to be removed and the remaining parts of the paragraphs to be merged into one. However, Word 2007 removes the text but inserts a paragraph mark to leave me with two paragraphs still. This is not how it used to be and not what I want it to be but I can not find a way to stop it doing this. It's bad enough to have to manually delete the new paragraph mark, but we have many hundreds of templates controlled by macros that are being badly affected by this. How do I stop Word inserting a paragraph mark? |
#16
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Word 2007 Deleting across paragraphs does not delete paragraph
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 -- Regards Lene Fredborg - Microsoft MVP (Word) DocTools - Denmark www.thedoctools.com Document automation - add-ins, macros and templates for Microsoft Word "Graham Mayor" wrote: 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 |
#17
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
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 |
#18
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Word 2007 Deleting across paragraphs does not delete paragraph
Hi Graham
MS go to great pains to warn you about what happens when you delete paragraph marks - and then they go and stop you doing it without, as far as I've been able to make out, any way to switching that off. Another instance of them assuming that we're all idiots and don't know what we're doing! Whilst some of my users may fall into that category, I'm don't, but I'm rapidly running out of patience with 2007 and all the "defaults" that you can't do anything about. Whilst the space/backspace suggestion would probably work ok, it is still just a workaround to a problem that MS have created and needn't have done. Andy "Graham Mayor" wrote: Whether this is 'by design' I cannot say, but here is a certain logic in it. The formatting associated with a paragraph is stored in the paragraph break. By retaining that paragraph break the formatting of the two parts is retained. There is less 'pain' if instead of pressing 'delete' or 'backspace', the users press 'space' then 'backspace'. -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org ATD wrote: 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 |
Reply |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Paragraph Character not acting like seperate paragraphs | Microsoft Word Help | |||
How do i combined multi paragraphs text in one paragraph | Microsoft Word Help | |||
how do I delete (not hide) all paragraph marks in word 2007? | Microsoft Word Help | |||
Whene I delete something word re-formats paragraphs | Microsoft Word Help | |||
Can I MERGE PARAGRAPHS without manualy deleting paragraph end tags | Microsoft Word Help |