View Single Post
 
Old 10-13-2023, 08:21 PM
syl3786 syl3786 is offline Windows 10 Office 2019
Advanced Beginner
 
Join Date: Jan 2023
Posts: 97
syl3786 is on a distinguished road
Exclamation Deleting styles but keep text's format

Hello everyone,

I have two macros. The first one copies text from Word to Excel based on an Excel list, while the second one adds hyperlinks according to an Excel file.

Recently, I encountered an issue where the text I want the macro to copy has different styles. E.g.: Selection.Style = ActiveDocument.Styles("ABCF2")"



However, this limitation prevents the macro from copying text, even though I already added the following code to inform the macro to identify and copy them:


With Selection.Find
.Font.Name = "Times New Roman"
.Font.Size = 14
.Font.Underline = 0
.Font.Color = wdColorBlack
.MatchWildcards = True



To address this problem, I manually applied the same font name to the text, which allowed the macro to recognize and copy it.

I would greatly appreciate any suggestions or solutions to overcome this challenge. Thank you in advance.
Reply With Quote