Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 07-26-2023, 07:13 PM
Journeyman Journeyman is offline Copy highlighted words from Word Document to designated Excel file Windows 10 Copy highlighted words from Word Document to designated Excel file Office 2019
Novice
 
Join Date: Feb 2023
Posts: 15
Journeyman is on a distinguished road
Default

This is a very easy method to find highlighted text in your word document

Code:
Sub Runme()
'Note that this code is written into a word VBE. You could just as easy write something similar into excel.

Dim w As Variant
    For Each sentence In ActiveDocument.StoryRanges
        For Each w In sentence.Words
             'Returns a bolded word
            If w.Font.Bold = True Then Debug.Print "Bold: " & w
             'Returns a highlighted word
            If w.HighlightColorIndex > 0 Then Debug.Print "Hightlight: " & w
        Next
    Next
End Sub
I previously replied to another post today, which will explain how to copy text into an excel file. The post is written for excel, and is for code run in excel, but will give you a good idea how to copy information from Word into Excel:

https://www.msofficeforums.com/word-...text-word.html

Give it a go and see where you end up.
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Highlight word document with words from .txt file Big_Sugah Word VBA 11 01-24-2023 02:15 PM
Copy highlighted words from Word Document to designated Excel file How to use Word Macro to change all highlighted words as mark-up? hcl75 Word VBA 3 10-08-2022 02:39 PM
Copy words from word to excel TA9523 Word VBA 13 01-30-2021 06:50 AM
Macro to highlight repeated words in word file and extract into excel file aabri Word VBA 1 06-14-2015 07:20 AM
Copy highlighted words from Word Document to designated Excel file How to copy automatically data from Excel file to Word file? fuchsd Word 6 10-25-2011 05:52 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 06:53 AM.


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