'Finding and opening pdf according to the files in the cells with vba

I want to open a pdf according to the codes in a table that changes daily from the archive with thousands of files.

It has to search in two ways.

  1. Search by BA220025 or BE210075 codes and find the relevant folder

  2. It will list and open pdf files with names such as eb, efb, blcwt, fn, fnb, blcvt in the folder.

This is the code I am using

Option Explicit

Private Sub CommandButton1_Click()
    Dim Pdf_File As String
    
    Pdf_File = Me.TextBox1
    
    Application.ScreenUpdating = False
    Me.WebBrowser1.Navigate "T:BA\MJOP\MLIST"
    If Pdf_File <> "" Then
        Me.WebBrowser1.Document.Write "<HTML><Body><embed src=""" & Pdf_File & _
                                      """ width=""100%"" height=""100%"" /></Body></HTML>"
        Me.WebBrowser1.Refresh
    End If
    Application.ScreenUpdating = True
End Sub

Sub ML()
    dosya = "T:BA\MJOP\MLIST"
    CreateObject("Shell.Application").Open dosya
End Sub


Private Sub TextBox2_Change()

End Sub

Private Sub UserForm_Initialize()
    Me.Caption = "UserForm PDF"
End Sub

Private Sub WebBrowser1_StatusTextChange(ByVal Text As String)

End Sub

I tried to adapt the codes I found in my searches on the site (example: Find a file in folder using different keywords VBA) but I couldn't because I'm new to these issues.

The picture of the relevant table is attached

Your help is very important to me. Thanks in advance.

enter image description here



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source