Question: Can someone help me with the following: 

I have an issue with "`Set ch1 =`"

The file name (or rather the last few characters of its name change slightly everyday), thus I need to add wildcard (\*) or something similar. 

How do I do "Set ch1 =" with a file, which name changes?

Here is part of the code I have developed. 

```
Option Explicit
Sub Open_Latest_Cheque()
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Call Open_Latest_File

Dim ch1 As Workbook, AC As Workbook, temp As Workbook
Dim ch1ws As Worksheet, ACws As Worksheet
Dim ACwsLR As Long, tempName As String

**Set ch1 = Workbooks("Sum100123.csv")**
Set ch1ws = ch1.Sheets(1)
Set AC = Workbooks("Mon.xlsm")
Set ACws = AC.Sheets("Data")

Dim MyPath  As String, MyFile  As String, LatestFile  As String
Dim LatestDate  As Date, LMD  As Date.............

```

Thanks

Answer: 
Try this:

```
Sub test_partial_name()

Dim pt_nm As Workbook

For Each pt_nm In Application.Workbooks
   If (pt_nm.Name) Like "Sum1#123.csv" Then
Exit For
End If

Next pt_nm
   If Not pt_nm Is Nothing Then
   pt_nm.Activate
Else
MsgBox "The file has not opened!"
End If

With Sheets(1)

Cells(1, 1).Value = "its working? Yes"

End With

```
A way to do it is to loop through the collection of workbooks with `For Each wkb in Workbooks` and to check the name of every iterated workbook with `Like`. There, you may use `*`, `#`, `?`, etc (see the screenshot). Once you find what you need assign it to the `wbkSpecific` and exit the collection with `Exit For`:

```
Sub TestMe()

    Dim wkb As Workbook
    Dim wkbSpecific As Workbook

    For Each wkb In Workbooks
        If wkb.Name Like "Sum1*???.csv" Then
            Set wkbSpecific = wkb
            Exit For
        End If
    Next wkb

    If Not wkbSpecific Is Nothing Then
        MsgBox wkbSpecific.Name
    End If

End Sub

```

* [Like Operator MSDN](https://learn.microsoft.com/en-us/dotnet/visual-basic/language-reference/operators/like-operator)

[![enter image description here](https://i.stack.imgur.com/mhPkC.png)](https://i.stack.imgur.com/mhPkC.png)