![]() |
|
|
|
#1
|
|||
|
|||
|
I have many documents to edit, looking for paras and sentences of interest.
I find them, select them, cut and paste them into another document at present. Slow, clumsy, tedious. If I could just highlight the parts of interest and maybe change their colour or something and then at the end of the document select all such parts and copy/paste elsewhere it'd be a godsend. any such thing possible? Must be millions of people doing what I'm doing. How're they all doing it? |
|
#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 |
|
#3
|
||||
|
||||
|
Quote:
1. make a copy of the document; 2. highlight all content in the copy; 3. remove the highlight from the parts you want to retain; then 4. use Find/Replace to delete all highlighted text. Simple, effective, and no macros required.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
#4
|
|||
|
|||
|
Wonderful, Thank you both.
I got the macro to work well and I like it. Especially as my next project is to try to come to grips with macros. Would just be nice if I could do the whole document before firing the macro and it would copy all the selected (or highlighted?) sections. So that if I found fifty such sections I wanted I'd save 49 keypresses there. The copy/highlight method sounds good but I couldn't really get it working well. When I copy a doc and select it all then any attempt to touch the text switches off all the selection. If you were meaning for me to change the colour of the text - and I guess you were - then it seems a long hassle for deselecting the colour each time. Kind of defeating the purpose which is to save on keystrokes. But perhaps I've misunderstood that whole idea. |
|
#5
|
||||
|
||||
|
Quote:
Quote:
Indeed.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
#6
|
||||
|
||||
|
__________________
Andrew Lockton Chrysalis Design, Melbourne Australia |
|
| 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 |