View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Post Tenebras Lux Post Tenebras Lux is offline
external usenet poster
 
Posts: 41
Default VBA Replace using wildcard?

I have a very long string (an HTML document).

I want to replace all instances of a substring for which I know the first
few characters and the end character, but the middle part of the substring
can vary in both length and additional characters.

For example, if I want to replace each of the following using the Replace
function and wildcards:
<td class="dkbluelt" with <td
<td valign="top" bgcolor=#99cbe5" align="left" with <td

I have built a for loop using Instr and Mid functions, but it takes a long
time to run.

Is there any way to use the replace function in VBA using wildcards? for
example:
Result = Replace(MyLongString, "<td*", "<td")

Thanks for any suggestions.