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/index.do*"

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/index.do,https://servman/sm/index.do#,https://servman/sm/index.do?lang=en,https://servman/sm/index.do?lang=en&mode=index.do,https://servman/sm/index.do?lang=en&mode=index.do&logout_msg=LogoutPage.session_timeout"
  
    ' 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
                Next
                If blnFoundWebSite = True Then Exit For
            End If
        End If
    Next
    
    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
ErrorRoutine:

End Sub

Open in new window

kbay808Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
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 LambertFabrice LambertCommented:
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.
0
kbay808Author Commented:
All of the URLs start with "https://servman/sm/index.do".  It doesn't matter what comes after it.
0
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/index.do?

What do you see if you navigate to https://servman/sm/index.do?
0
Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

kbay808Author Commented:
Just to clarify, the code does not open the URL.  It's just searching IE for one that is already open.
0
Fabrice LambertFabrice LambertCommented:
Hmm, having a code that open the same web page with various parameters at the same time.... suspicious if you ask me.
0
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

0

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.
0
kbay808Author Commented:
That worked perfect!!!  Thanks
0
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
VBA

From novice to tech pro — start learning today.