How to add a wildcard to a URL in VBA?

In the code below, I have multiple versions of the same URL.  I would like to change it to something like this with a wildcard. "https://servman/sm/*"

Sub getIE(ByRef objIE As Object, ByRef blnFoundWebSite As Boolean)
On Error GoTo ErrorRoutine
    Dim strURL      As Variant
    Dim strURLs     As String
    Dim objShell    As SHDocVw.ShellWindows
    Dim objIEDOC    As Object
    Set objShell = New SHDocVw.ShellWindows

' **** Set the Web Address Here ****
    strURLs = "https://servman/sm/,https://servman/sm/,https://servman/sm/,https://servman/sm/,https://servman/sm/"
    ' Look for the appropriate open IE Window
    For Each objIE In objShell
        If TypeOf objIE.Document Is MSHTML.HTMLDocument Then
            Set objIEDOC = objIE.Document
            If Not (objIEDOC Is Nothing) Then
                For Each strURL In Split(strURLs, ",")
                    If objIEDOC.URL = strURL Then
                        blnFoundWebSite = True
                        Exit For
                    End If
                If blnFoundWebSite = True Then Exit For
            End If
        End If
    On Error Resume Next
    Set objIE = objIE
    Set objIE = objIE.frames.Item(0)
    Set objIE = objIE.frames.Item(1)
    On Error GoTo 0
    Set objShell = Nothing
    Set objIEDOC = Nothing
Exit Sub

End Sub

Open in new window

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Fabrice LambertConsultingCommented:
Then what do you want to do with the wildcard ?
Replace it with various values ?

If so, it is better to have a base URL (constant if possible), and concatenate the different values later.
kbay808Author Commented:
All of the URLs start with "https://servman/sm/".  It doesn't matter what comes after it.
NorieAnalyst Assistant Commented:
You can't use a wildcard in a URL to navigate to a site.

Do you have a list of possible values, or perhaps some sort of string pattern that could come after the 'base' URL https://servman/sm/

What do you see if you navigate to https://servman/sm/
OWASP Proactive Controls

Learn the most important control and control categories that every architect and developer should include in their projects.

kbay808Author Commented:
Just to clarify, the code does not open the URL.  It's just searching IE for one that is already open.
Fabrice LambertConsultingCommented:
Hmm, having a code that open the same web page with various parameters at the same time.... suspicious if you ask me.
NorieAnalyst Assistant Commented:
You could try changing this to look for a partial match instead of an exact match.

  If objIEDOC.URL = strURL Then

Open in new window

Perhaps something like this where strURL contains the 'base' URL.
  If objIEDOC.URL Like strURL & "*" Then 

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
kbay808Author Commented:
It's not opening it.  The web page is already open.  I just need to target it to click buttons and input data.
kbay808Author Commented:
That worked perfect!!!  Thanks
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.