View Single Post
 
Old 11-11-2018, 12:06 AM
gloub gloub is offline Windows 7 64bit Office 2003
Novice
 
Join Date: Feb 2018
Location: Paris, France
Posts: 29
gloub is on a distinguished road
Default

One more point (on a different matter).
One thing impresses me in your code : you manage to move a paragraph with no change in the page display.

I've made lots of macros to move paragraphs from one place to another in my todolist.
The only method I've found (due to my lack of knowledge in VBA) is to insert a chain (say "µµµµ") then move the paragraph, then move back to the chain, then delete it, which may make unpleasant display changes.
Is there a way to improve this archaic method to get the same result than in you macro : move a paragraph while the display remains unchanged ?

Many thanks !

HTML Code:
Sub Move_To_Next_Monday()
' this macro finds the next paragraph starting with "~Monday" then moves the selected chain one line further then goes back to where the selected text was at the beginning

    Application.ScreenUpdating = False

    Selection.HomeKey Unit:=wdLine
    Selection.EndKey Unit:=wdLine, Extend:=wdExtend
    Selection.Cut
    Selection.TypeText Text:="µµµµ"
    Selection.Find.ClearFormatting
    With Selection.Find
        .Text = "~Monday"
        .Replacement.Text = ""
        .Forward = True
    End With
    Selection.Find.Execute
    
    Selection.HomeKey Unit:=wdLine
    Selection.MoveDown Unit:=wdLine, Count:=1
    Selection.Paste
    Selection.HomeKey Unit:=wdStory
    Selection.Find.ClearFormatting
    With Selection.Find
        .Text = "µµµµ"
        .Replacement.Text = ""
        .Forward = True
    End With
    Selection.Find.Execute
    
    Selection.Delete Unit:=wdCharacter, Count:=1
End Sub
Reply With Quote