#1
|
|||
|
|||
A way to auto-copy certain parts of text
Hello everyone,
I have this kind of question, I'm not sure if it's possible but hope dies last. I am writing a paper, the links to used sources are written in the format: [smith, p.21]. Because of my laziness I did not copy these links while writing and I am now facing the situation that I need to make a list of sources and they are all scattered throughout the text. So i've been wondering: is it possible to somehow auto-copy the these square brackets bits '[***]' to the end of the document? I mean I could find these bits by typing [ in search, yes, but I would have to copy everything manually and that would take a lot of time since I have LOTS of these things. I would appreciate any help. Thank you. |
#2
|
||||
|
||||
1. Format all of your text as hidden.
2. Use a wildcard Find/Replace, where: • Find = \[*\] • Replace = ^& with the replacement set to 'not hidden' 3. Copy the document content 4. Format all of your text as NOT hidden. 5. Go to the end of the document and use Paste Special>Unformatted Text.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#3
|
||||
|
||||
Depending on wwhether you have used [ ] elsewhere in the document the following macro should work
Code:
Sub Macro1() Dim oRng As Range Dim oColl As Collection Dim i As Integer Set oColl = New Collection Set oRng = ActiveDocument.Range With oRng.Find Do While .Execute(findText:="\[*,*\]", MatchWildcards:=True) oColl.Add oRng.Text Loop End With For i = 1 To oColl.Count ActiveDocument.Range.InsertAfter vbCr & oColl(i) DoEvents Next i lbl_Exit: Set oRng = Nothing Set oColl = Nothing Exit Sub End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
#4
|
|||
|
|||
Thank you very much for your help! I have found an easy solution based on your advice.
In a copy of the file I used: Find \]*\[ Replace with ^p Use wildcards on This removes all of the text apart from the stuff that was in the brackets and replaces it with a paragraph so that each bit from the brackets starts with a new line. Only the first and the last bits of text don't get removed, but these are east enough to be deleted manually. Thank you! |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Auto populate text box based on drop-down content control and repeat the process via copy paste | helenndp | Word VBA | 2 | 09-27-2018 11:04 AM |
How do I edit text in Quick Parts? | TommyVincent | Word | 4 | 07-30-2014 01:51 PM |
how to automatically copy parts of a record to another sheet? | kmeechan | Excel | 1 | 05-28-2014 02:24 AM |
auto copy function | omer123456 | Excel | 0 | 12-18-2011 08:22 AM |
Can't Enter Text In Parts After Protection | gapi | Word Tables | 1 | 11-05-2011 02:24 AM |