Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 01-19-2023, 06:20 PM
Guessed's Avatar
Guessed Guessed is offline Highlight word document with words from .txt file Windows 10 Highlight word document with words from .txt file Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 4,185
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

It would most likely be due to that. The sample you provided only had short URLs so we didn't anticipate much longer strings.

I assume the text file isn't changed often so it would be easier to edit that to split any of overly long lines by adding a paragraph mark in a logical location than it would be to add complexity to the vba code.

I would expect the maximum string length to be something around a power of 2 eg 64, 128 or 256 characters. You can hover your mouse over the Len(sFind) to see how big the unacceptable number is.
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
  #2  
Old 01-22-2023, 05:23 PM
Big_Sugah Big_Sugah is offline Highlight word document with words from .txt file Windows 10 Highlight word document with words from .txt file Office 2016
Novice
Highlight word document with words from .txt file
 
Join Date: Jan 2023
Posts: 5
Big_Sugah is on a distinguished road
Default

Quote:
Originally Posted by Guessed View Post
It would most likely be due to that. The sample you provided only had short URLs so we didn't anticipate much longer strings.

I assume the text file isn't changed often so it would be easier to edit that to split any of overly long lines by adding a paragraph mark in a logical location than it would be to add complexity to the vba code.

I would expect the maximum string length to be something around a power of 2 eg 64, 128 or 256 characters. You can hover your mouse over the Len(sFind) to see how big the unacceptable number is.
Hi Guessed,

Thanks for this, I just changed the script (That generates the .txt document) to cull links over 256
I've got one more question, it seems that the VBA macro will highlight any words separated by spaces. Is there a way to instead find and replace by the whole word?
For example if I had the word "Google Account Services" in the .txt document instead of Google, Account and Services being highlighted I only wanted occurrences of the entire word.
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Highlight word document with words from .txt file Find and highlight multiple words in MS Word document AtaLoss Word VBA 37 09-22-2021 12:04 PM
Highlight word document with words from .txt file Macro To Identify & Highlight Words In MS Word Based Upon A List In Excel File Column abhimanyu Word VBA 5 03-20-2020 01:33 PM
How to find (highlight) two and more words in a list of 75k single words in Word 2010 Usora Word 8 05-29-2018 03:34 AM
Find and highlight multiple words in MS Word document qkjack Word VBA 7 02-21-2018 07:09 PM
Macro to highlight repeated words in word file and extract into excel file aabri Word VBA 1 06-14-2015 07:20 AM

Other Forums: Access Forums

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