I am attempting to search for a file using wild cards but am having trouble making it work.
I get the Run-time error '52'
Bad File name or number
Here is my code
Sub OpenFiles()
Dim MyFolder As String
Dim MyFile As String
MyFolder = "https://xyz.zyz.com/sites/............/Labor%20Tool%20Data" 'EXACT folder name containing the files. Change to suit, but don't forget the trailing backslash '\'
Debug.Print MyFolder
MyFile = Dir(MyFolder & "/*066*.xlsm")
Do Until MyFile = ""
Workbooks.Open filename:=MyFolder & "" & MyFile
MyFile = Dir
Loop
End Sub
I am using the full path name to the folder.
I have read in various post that this is possible. Why do i always get "Bad File name or number"?
IS this possible to search for a file with in a folder using wild cards?
E35123
I get the Run-time error '52'
Bad File name or number
Here is my code
Sub OpenFiles()
Dim MyFolder As String
Dim MyFile As String
MyFolder = "https://xyz.zyz.com/sites/............/Labor%20Tool%20Data" 'EXACT folder name containing the files. Change to suit, but don't forget the trailing backslash '\'
Debug.Print MyFolder
MyFile = Dir(MyFolder & "/*066*.xlsm")
Do Until MyFile = ""
Workbooks.Open filename:=MyFolder & "" & MyFile
MyFile = Dir
Loop
End Sub
I am using the full path name to the folder.
I have read in various post that this is possible. Why do i always get "Bad File name or number"?
IS this possible to search for a file with in a folder using wild cards?
E35123