Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 06-13-2020, 12:55 PM
akherousia akherousia is offline A way to auto-copy certain parts of text Windows 7 64bit A way to auto-copy certain parts of text Office 2016
Novice
A way to auto-copy certain parts of text
 
Join Date: Jun 2020
Posts: 2
akherousia is on a distinguished road
Default 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.
Reply With Quote
  #2  
Old 06-13-2020, 08:04 PM
macropod's Avatar
macropod macropod is offline A way to auto-copy certain parts of text Windows 7 64bit A way to auto-copy certain parts of text Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,962
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

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]
Reply With Quote
  #3  
Old 06-13-2020, 08:13 PM
gmayor's Avatar
gmayor gmayor is offline A way to auto-copy certain parts of text Windows 10 A way to auto-copy certain parts of text Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,101
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 of
Default

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
Reply With Quote
  #4  
Old 06-14-2020, 03:40 AM
akherousia akherousia is offline A way to auto-copy certain parts of text Windows 7 64bit A way to auto-copy certain parts of text Office 2016
Novice
A way to auto-copy certain parts of text
 
Join Date: Jun 2020
Posts: 2
akherousia is on a distinguished road
Default

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!
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
A way to auto-copy certain parts of text 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
A way to auto-copy certain parts of text 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
A way to auto-copy certain parts of text Can't Enter Text In Parts After Protection gapi Word Tables 1 11-05-2011 02:24 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 08:11 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft