Moving Text

Getting the current selection

Dim objRange As Range 
Set objRange = Application.Selection.Range

Turn off extension mode

Selection.ExtendMode = False 

This refers to the whole document

objRange = ActiveDocument.Range() 

??

Documents.Add Template:="Normal", NewTemplate:=False 
ActiveDocument.Content.Information(wdInformation.wdActiveEndAdjustedPageNumber)
ActiveDocument.Close SaveChanges := wdDoNotSaveChanges

Copy the entire document

Selection.HomeKey Unit:=wdUnits.wdStory 
Selection.Extend
Selection.WholeStory

Looping until the end of the document

Do Until ActiveDocument.Bookmarks("\Sel") = ActiveDocument.Bookmarks("\EndOfDoc") 
   ...
Loop

Is the Insertion point at the end of a document

If Selection.Type = wdSelectionType.wdSelectionIP And _ 
   Selection.End = ActiveDocument.Content.End - 1 Then

End If


© 2022 Better Solutions Limited. All Rights Reserved. © 2022 Better Solutions Limited TopPrevNext