VBA Replace Function with WildCard

Thanks Thanks:  0
Likes Likes:  0
Results 1 to 2 of 2

Thread: VBA Replace Function with WildCard

  1. #1
    Board Regular giacomo's Avatar
    Join Date
    Feb 2002
    Posts
    1,802
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default VBA Replace Function with WildCard

     
    I want to use the replace function in VBA to do a wildcard search. Seems like I've been able to do this before but am having the hardest time remembering how.

    example:
    x = "test"
    debug.print replace(x,"t*t","hi")

    still prints "test" instead of "hi"

  2. #2
    Board Regular VicRauch's Avatar
    Join Date
    Mar 2006
    Location
    Sacramento, CA
    Posts
    2,032
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

      
    I tried this:

    x = "t*t"
    debug.Print replace(x,"t*t","hi")

    and got "hi" returned. Which looks like it does not accept wildcards. I did not see any wiggle room for wildcards when I read the Help topic. Could it have been something that also incorporated the "Like" keyword?

    Sorry I can't help, but still wanted to encourage you to keep looking. It looks like it will be useful if you find a way to do it.
    Vic

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

 

 
DMCA.com