in

VBA: select WHOLE document (i.e. the not the current textbox!)

I am using the following code to try to copy the current document to a new document (for further processing):


Selection.WholeStory
    Selection.Copy
    Documents.Add Template:="Normal", NewTemplate:=False, DocumentType:=0
        Selection.PasteAndFormat (wdPasteDefault)
   
    ActiveDocument.SaveAs FileName:=sTemp, FileFormat:= _
        wdFormatDocument, LockComments:=False, Password:="", Addtorecentfiles:= _
        True, WritePassword:="", ReadOnlyRecommended:=False, EmbedTrueTypeFonts:= _
        False, SaveNativePictureFormat:=False, SaveFormsData:=False, _
        SaveAsAOCELetter:=False
    ActiveDocument.Close


The problem I have is that if the document contains textboxes, and the focus is on a textbox, then ONLY THE CONTENTS OF THE TEXTBOX is copied using the

Selection.WholeStory

command.

How do I set the range to be the whole of the document?

Thanks.
Movie Stars

Solution: VBA: select WHOLE document (i.e. the not the current textbox!)

If you use the Range, it doesn't matter where the Selection is.

1:
2:
3:
4:
5:
6:
7:
8:
Sub CopyDoc()
    Dim docSource As Document
    Dim docDest As Document
    Set docSource = ActiveDocument
    Set docDest = Documents.Add
    docSource.Range.Copy
    docDest.Range.Paste
End Sub