Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #8  
Old 08-21-2023, 09:40 AM
vivka vivka is offline VBA to cut colored text from one document and paste to another Windows 7 64bit VBA to cut colored text from one document and paste to another Office 2016
Expert
 
Join Date: Jul 2023
Posts: 302
vivka is on a distinguished road
Default

Your code does work for WdGreen! The problem is your green font isn't actually the vba WdGreen,
although Word sets it as green. The vba green & the Word green have the same value (11) but are different colors!
Check for yourself using RGB codes: the genuine (vba) WdGreen is R=0, G=128, B=0 but your Word green is anything else.
It's strange, but the Word's Find-Replace dialogue recognizes the Word's green, set using the Find-Replace Format Font dialogue,
but doesn't recognize the vba WdGreen, while the vba / macro code recognizes the vba WdGreen but is blind to the Word Green.


To make the macro work for your "green", select any part of the colored text & use
msgbox selection.Font.ColorIndex
to get the code of your color. Then replace WdGreen in Find with the obtained code.
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
VBA to cut colored text from one document and paste to another Copy selected text from one document and paste to new document in same position on the page gasparik Word VBA 1 05-11-2020 05:41 AM
VBA to cut colored text from one document and paste to another Why do pages 10-24 disappear when I type in more text on page 2 or paste new text into the document? RET Word 1 05-02-2016 07:28 PM
VBA to cut colored text from one document and paste to another colored background to text userman Word 2 09-26-2012 01:52 AM
not showing colored text from external emails MasterGator Outlook 0 01-31-2012 02:20 PM
Making text boxes with colored bar at the top daviddoria PowerPoint 0 08-30-2009 03:19 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 12:16 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