I am trying to write a vba myself and need some help. I have searched the web and have stared with my first steps of Opening the Files that I have in my folder.See the code below. Next I need help, within this code to have it open only certain files that contain the date. For example with the examples below I only want to open the files with 5-17-2017. When running this macro the date selection that I wish to open my change.
test05-17-2017.xls
newtes05-17-2017.xls
oldtest05-15-2017.xls
test05-17-2017.xls
newtes05-17-2017.xls
oldtest05-15-2017.xls
Code:
Sub OpenFilesToday()
Dim MyFolder As String
Dim MyFile As String
MyFolder = "C:\Users\drew\Documents"
MyFile = Dir(MyFolder & "\*.xls*")
Do While MyFile <> ""
Workbooks.Open Filename:=MyFolder & "\" & MyFile
MyFile = Dir
Loop
End Sub