![]() |
|
#2
|
||||
|
||||
|
You could use a macro in your normal template to copy the selection to another document with a single click e.g.
Code:
Sub SaveExtractToDocument()
'Graham Mayor - https://www.gmayor.com - Last updated - 02 May 2021
Dim oDoc As Document, oNewDoc As Document
Dim oRng As Range, oNewRng As Range
Dim strPath As String
Dim FSO As Object
If Documents.Count = 0 Then
MsgBox "No document open", vbCritical
GoTo lbl_Exit
End If
If Len(Selection) = 1 Then
MsgBox "Nothing selected", vbCritical
GoTo lbl_Exit
End If
Set oDoc = ActiveDocument
strPath = Environ("USERPROFILE") & "\Desktop\Extract.docx"
Set FSO = CreateObject("Scripting.FileSystemObject")
If FSO.FileExists(strPath) Then
Set oNewDoc = Documents.Open(strPath)
Else
Set oNewDoc = Documents.Add
oNewDoc.SaveAs2 strPath
End If
oDoc.Activate
Set oRng = Selection.Range
oRng.Copy
Set oNewRng = oNewDoc.Range
oNewRng.Collapse 0
oNewRng.Paste
oNewRng.InsertParagraphAfter
'oNewDoc.Save 'Optional
lbl_Exit:
Set oDoc = Nothing
Set oNewDoc = Nothing
Set oRng = Nothing
Set oNewRng = Nothing
Set FSO = Nothing
Exit Sub
End Sub
In this case the macro will add the selection to the end of a document 'Extract.docx' which it will create and save on your desktop if not already present.
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
| Tags |
| copying, selecting |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Word 2007 - Document returns to first page without warning and does not save last edits. | paulbasel | Word | 11 | 12-16-2018 04:36 PM |
| In Word2010, When 2 documents are open, I try to save edits in one, it flips to 2nd document | amymitamateur | Word | 0 | 03-09-2017 12:42 PM |
Jumping between edits
|
paik1002 | Word VBA | 1 | 12-08-2015 04:53 AM |
| edits to meeting requests don't show up with other users | StarCSR | Outlook | 2 | 04-03-2013 07:05 AM |