Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #15  
Old 11-11-2018, 12:06 AM
gloub gloub is offline How to move a line to another line that starts with a chain selected in the 1st one? Windows 7 64bit How to move a line to another line that starts with a chain selected in the 1st one? Office 2003
Novice
How to move a line to another line that starts with a chain selected in the 1st one?
 
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
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to move a line to another line that starts with a chain selected in the 1st one? Document starts to red line spaces and formatting appears on right side Richtriebe Word 2 03-23-2017 11:53 AM
Bold each line of text that starts with a recurring symbol qubie Word 6 08-26-2016 07:10 AM
Lock line so text does not move to next line saundrals Word 2 06-19-2014 03:59 PM
How to move a line to another line that starts with a chain selected in the 1st one? Identify certain text and move all phrases containing it down a line Chayes Word VBA 2 11-26-2013 01:16 PM
How to move a line to another line that starts with a chain selected in the 1st one? How to give line numbering to only selected text? garlapati Word 5 04-04-2011 02:05 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 05:58 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft