#1
|
|||
|
|||
Copy paste highlighted text to another doc
I am trying find/build a macro that can copy all my highlighted text in a word document and paste it to another document. Is this possible? |
#2
|
|||
|
|||
Hi
Are you looking to copy your highlighted text to a new blank document or an existing document? If it is an existing document is to a specific location in that document? Tony |
#3
|
|||
|
|||
Hi Tony,
It will be posted to a new blank doc. |
#4
|
|||
|
|||
And by "highlighted", do you mean that you have selected text (highlighted); or do you mean non-selected text that has highlights
|
#5
|
|||
|
|||
The highlighted sentences are from using the yellow Highlighter feature from the menu on the homepage. It has a highlighter pen look to it.
|
#6
|
|||
|
|||
Code:
Sub CopyHighlightsToOtherDoc() Dim ThisDoc As Document Dim ThatDoc As Document Dim r As Range Set ThisDoc = ActiveDocument Set r = ThisDoc.Range Set ThatDoc = Documents.Add With r.Find .Text = "" .Highlight = True Do While .Execute(Forward:=True) = True ThatDoc.Range.InsertAfter r.Text & vbCrLf r.Collapse 0 Loop End With End Sub All highlighted text in the ActiveDocument are copied (with an added paragraph mark to separate them) to a new document. |
#7
|
||||
|
||||
Cross-posted (and solved only 20 minutes after the last post by MSOffice1) at: http://www.excelforum.com/word-progr...html?p=3119500
For cross-posting etiquette, please read: http://www.excelguru.ca/content.php?184
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#8
|
|||
|
|||
Thanks Fumei. I cant tell you how much I appreciate it : )
|
#9
|
|||
|
|||
Hello awesome Forums,
Obviously you can tell that I am new to this..ie this is my first post! The reason I posted the question on this forum is b/c my question is related to MS Word and not MS Excel. I thought the other site was primary for Excel questions (hence the forum name) and would not receive an accurate response or any response at all...ie 2 different program sites. What I should of done was delete the question on the other site. Sorry for the confusion and I hope you understand. Have a great end of the week and weekend Thx |
#10
|
|||
|
|||
Fumei,
Thank you again for the code you provided. Can you tweak this where it will copy and past rather than cut and paste to the other doc. Thanks |
#11
|
|||
|
|||
How can I add page number and section heading of the highlighted para along with highlighted para
|
#12
|
|||
|
|||
Quote:
So, I want to select the range and then copy it with the same formatting to a new document. I will appreciate your help by making such a VBA code to do my need. Thanks in advance |
#13
|
|||
|
|||
Quote:
This is awesome. But I was wondering if you can tweak this for my need. Basically it does the same thing but instead of pasting it in a new document I want it to override the current document. I want nothing else on that document but for the result to be pasted, then save it. This is so that I can keep the result under the same filename. Thank you. |
#14
|
||||
|
||||
You don't need a macro for that - simply:
• Format all content as hidden text • Use Find/Replace to find and unhide all highlighted text • Copy everything and paste it as unformatted text.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#15
|
|||
|
|||
I need it to be in a macro because the next step is creating a .bat for it that will automate doing it for multiple documents inside a folder. Thank you.
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Copy Text Twice to Paste into word | Albundy | Word | 2 | 09-02-2016 12:59 PM |
Find & selected paras with highlighted text & copy to clipboard | marceepoo | Word VBA | 1 | 09-14-2012 08:20 PM |
Table copy/paste suddenly text-only | mjcoon | Word Tables | 20 | 04-28-2012 08:53 PM |
Can't copy/cut and paste text in Word 2002 | mmiller751 | Word | 0 | 04-17-2012 02:55 PM |
Losing Text box data when copy and paste | Spay | Excel | 0 | 03-15-2011 07:18 AM |