extract (copy) highlighted text and paaste into .doc

M

mark

Macro or other option??? Please, can anyone help me?

I want to write a macro for word 2002 that: finds and
replaces (actually, extracts (copies) my highlighted text
from word 2002, powerpoint 2002 or Adobe .pdf documents
and enables the selceted tect to be pasted into a TOC in
a .doc file)

My highlighted red and green and pink and blue and yellow
text with a Table Of Contents (TOC) that had indents
levels:
1=red(article_headings),
2=green(article_issues),
3=pink(article_quotes),
4=yellow(article_references),
5=blue(my_issues),.

I'm reading lengthy articles and wish to highlight text
different colours depending upon the catagory [headings,
issues, quotes, references and my own added-in bits.


Ideally, I would like to highlight and click a [perhaps
the existing outlining] toolbar button. If I can assign
a toolbar picture, all the better.

Im running win xp home and Office xp. Any other
suggestions would be greatly appreciated including other
newsgroup. many thanks, mark
 
M

Mark Tangard

Mark,

You'll need to restate this more clearly. Do you want to
end up with a document containing all of the text you've
highlighted? If so, did you want all the text blocks
sorted into 5 groups by color, or do you want to display
them in the order in which they're found in the document
but indented according to their color?

Also, I'm quite sure Word does not talk to Adobe Acrobat,
so don't expect to be able to automate that process without
a major intermediate step of copying text from a PDF into
a Word file, which seems like it would defeat much of the
purpose.
 
M

mark wells

Thank you Mark,

The second option. Sorry. yes you are right, I want it
to come out in order in which they are found and indinted
acording to color.



8888888888888
Mark,

You'll need to restate this more clearly. Do you want to
end up with a document containing all of the text you've
highlighted? If so, did you want all the text blocks
sorted into 5 groups by color, or do you want to display
them in the order in which they're found in the document
but indented according to their color?

Also, I'm quite sure Word does not talk to Adobe Acrobat,
so don't expect to be able to automate that process without
a major intermediate step of copying text from a PDF into
a Word file, which seems like it would defeat much of the
purpose.

--
Mark Tangard <[email protected]>, Microsoft Word MVP
Please reply only to the newsgroup, not by private mail.
Note well: MVPs do not work for Microsoft.
"Life is nothing if you're not obsessed." --John Waters

Macro or other option??? Please, can anyone help me?

I want to write a macro for word 2002 that: finds and
replaces (actually, extracts (copies) my highlighted text
from word 2002, powerpoint 2002 or Adobe .pdf documents
and enables the selceted tect to be pasted into a TOC in
a .doc file)

My highlighted red and green and pink and blue and yellow
text with a Table Of Contents (TOC) that had indents
levels:
1=red(article_headings),
2=green(article_issues),
3=pink(article_quotes),
4=yellow(article_references),
5=blue(my_issues),.

I'm reading lengthy articles and wish to highlight text
different colours depending upon the catagory [headings,
issues, quotes, references and my own added-in bits.


Ideally, I would like to highlight and click a [perhaps
the existing outlining] toolbar button. If I can assign
a toolbar picture, all the better.

Im running win xp home and Office xp. Any other
suggestions would be greatly appreciated including other
newsgroup. many thanks, mark
.
 
M

Mark Tangard

Here's the basic framework for the first 3 colors extracted
from a Word document. You can see the patten toward the end,
just add the same repeating block of code for the other colors
with each incrementing the '.LeftIndent' by 18 (points) (1/4").

--
Mark Tangard <[email protected]>, Microsoft Word MVP
Please reply only to the newsgroup, not by private email.
Note well: MVPs do not work for Microsoft.
"Life is nothing if you're not obsessed." --John Waters

Sub CollectHighlightedPassagesInNewDocument()
Dim NewDoc As Document, MainDoc As Document, r As Range
If Documents.Count = 0 Then Exit Sub
Set MainDoc = ActiveDocument
Set NewDoc = Documents.Add
MainDoc.Activate
Selection.HomeKey wdStory
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.Highlight = True
Do While .Execute
Set r = NewDoc.Range
r.Collapse wdCollapseEnd
Select Case Selection.Range.HighlightColorIndex
Case wdRed
r.InsertAfter Selection.Range.FormattedText
If Selection.Characters.Last.Text <> vbCr Then _
r.InsertAfter vbCr
r.HighlightColorIndex = wdRed
Case wdBrightGreen
r.Collapse wdCollapseEnd
r.InsertAfter Selection.Range.FormattedText
If Selection.Characters.Last.Text <> vbCr Then _
r.InsertAfter vbCr
r.ParagraphFormat.LeftIndent = 18
r.HighlightColorIndex = wdBrightGreen
Case wdPink
r.Collapse wdCollapseEnd
r.InsertAfter Selection.Range.FormattedText
If Selection.Characters.Last.Text <> vbCr Then _
r.InsertAfter vbCr
r.ParagraphFormat.LeftIndent = 36
r.HighlightColorIndex = wdPink
' :
' :
' : add code for the other colors here
' :
' :
End Select
Loop
End With
NewDoc.Activate
End Sub



mark said:
Thank you Mark,

The second option. Sorry. yes you are right, I want it
to come out in order in which they are found and indinted
acording to color.

8888888888888
Mark,

You'll need to restate this more clearly. Do you want to
end up with a document containing all of the text you've
highlighted? If so, did you want all the text blocks
sorted into 5 groups by color, or do you want to display
them in the order in which they're found in the document
but indented according to their color?

Also, I'm quite sure Word does not talk to Adobe Acrobat,
so don't expect to be able to automate that process without
a major intermediate step of copying text from a PDF into
a Word file, which seems like it would defeat much of the
purpose.

--
Mark Tangard <[email protected]>, Microsoft Word MVP
Please reply only to the newsgroup, not by private mail.
Note well: MVPs do not work for Microsoft.
"Life is nothing if you're not obsessed." --John Waters

Macro or other option??? Please, can anyone help me?

I want to write a macro for word 2002 that: finds and
replaces (actually, extracts (copies) my highlighted text
from word 2002, powerpoint 2002 or Adobe .pdf documents
and enables the selceted tect to be pasted into a TOC in
a .doc file)

My highlighted red and green and pink and blue and yellow
text with a Table Of Contents (TOC) that had indents
levels:
1=red(article_headings),
2=green(article_issues),
3=pink(article_quotes),
4=yellow(article_references),
5=blue(my_issues),.

I'm reading lengthy articles and wish to highlight text
different colours depending upon the catagory [headings,
issues, quotes, references and my own added-in bits.


Ideally, I would like to highlight and click a [perhaps
the existing outlining] toolbar button. If I can assign
a toolbar picture, all the better.

Im running win xp home and Office xp. Any other
suggestions would be greatly appreciated including other
newsgroup. many thanks, mark
.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top