Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 05-02-2021, 02:44 AM
gmayor's Avatar
gmayor gmayor is offline Is there a way to save only the edits? Windows 10 Is there a way to save only the edits? Office 2019
Expert
 
Join Date: Aug 2014
Posts: 4,144
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

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
Installing Macros
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
Reply With Quote
 

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
Is there a way to save only the edits? 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

Other Forums: Access Forums

All times are GMT -7. The time now is 10:59 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