Posts

Showing posts with the label Macro

HOW TO highlight a list of words from an Excel sheet within a Word doc with a macro

Image
I helped a relative who needed a list of words from an Excel sheet to be automatically highlighted within a Word document by writing  this macro based on samples from the Internet: The macro can be called by a menu item from the Word document in the Ribbon or Quick Access Toolbar. I set the name of the main macro while configuring the option for the Quick Access Toolbar. The Word macro will read words in a column  of a Excel sheet (from Column A of a sheet whose path is C:\wordlist.xlsx in the snippet and this can be changed) and then search & highlight all instances of these words or group of words within each cell that appear in the content of the Word document. As a Office Macro programming newbie, I found this MSDN article useful for getting started. Also see:  HOW TO create a Ribbon-less pre-Excel 2007 look